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:

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.custom_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.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: xycmap-1.0.0.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.0.tar.gz
Algorithm Hash digest
SHA256 2a2d036265c8f5d7feb0561232091f954a7c5bc5eaaa8cdbae01426457227f1c
MD5 20a5cad63be43dbb0aa2810f87f33b22
BLAKE2b-256 063e760ef5d8330eaa1020c2888efc7a3ca02275985c33ac38a94f12b3448c5b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xycmap-1.0.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d3effd7a3af194c0a516a47f640d5e733e94d9a7423f93c10dab847e0f157878
MD5 1c23831221b00f0f1bd82d0439f160ca
BLAKE2b-256 97b133d9eb0cacc8247ac2ec52a1869ee98f55109ed9e349fccf5d621c448efd

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