Skip to main content

Bivariate colormap solutions

Project description

xycmap

Bivariate colormap solutions.

This package makes it easy to create custom two-dimensional colormaps, apply them to your series, and add bivariate color legends to your plots.

example

Installation

pip install xycmap

Usage

Make a custom interpolated colormap by specifying four corner colors (see recognized formats here), and dimensions n:

import xycmap
corner_colors = ("lightgrey", "green", "blue", "red")
n = (5, 5)  # x, y
cmap = xycmap.custom_xycmap(corner_colors=corner_colors, n=n)

custom_xycmap

Or make a colormap by mixing two matplotlib colormaps, and specifying dimensions n:

import matplotlib.pyplot as plt
xcmap = plt.cm.rainbow
ycmap = plt.cm.Greys
n = (5, 5)  # x, y
cmap = xycmap.mean_xycmap(xcmap=xcmap, ycmap=ycmap, n=n)

mean_xycmap

With that in place, apply the colormap to two series that are numeric or categorical:

colors = xycmap.bivariate_color(sx=sx, sy=sy, cmap=cmap)

Note that you can apply limits to the axes, as well as pass custom bins for the axes (if numerical). See the docstring for details.

Then simply pass colors to your plot. To add a legend, create a new ax and run bivariate_legend() into the ax with the same parameters as bivariate_color(), e.g.:

cax = fig.add_axes([1, 0.25, 0.5, 0.5])
cax = xycmap.bivariate_legend(ax=cax, sx=sx, sy=sy, cmap=cmap)

Meta

Remco Bastiaan Jansen – r.b.jansen.uu@gmail.com - https://github.com/rbjansen

Distributed under the MIT license. See LICENSE for more information.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xycmap-1.0.1.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

xycmap-1.0.1-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file xycmap-1.0.1.tar.gz.

File metadata

  • Download URL: xycmap-1.0.1.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0.post20210125 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.5

File hashes

Hashes for xycmap-1.0.1.tar.gz
Algorithm Hash digest
SHA256 fd8ff0bc0b341fe5e691a12ea3d6fe35af26913912514830e053a9acfa4a5736
MD5 429220b77d29b65fb6f5aad072dafc90
BLAKE2b-256 f7d09ec6cd4913a726a19d7a9ff74e679bdad110b037f3f7e5ca5a0309200622

See more details on using hashes here.

File details

Details for the file xycmap-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: xycmap-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0.post20210125 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.5

File hashes

Hashes for xycmap-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 669652bd2049f251d713d73ae18694a4b6ef92f0f9a5c8092fc5bbd1f5fb50b8
MD5 21510c09cda0aa48a798e10fe628e5c3
BLAKE2b-256 1c6c6bbe66d9e40d8c50552a7df4014f557ae3aa67b990a4fa3f56fd92d07204

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page