Skip to main content

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.

Release files for xycmap 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xycmap 1.0.1
File Size Uploaded
xycmap-1.0.1.tar.gz 5.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for xycmap 1.0.1
File Interpreter ABI Platform
xycmap-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 11.1 kB

Release files / xycmap-1.0.1.tar.gz

Download URL xycmap-1.0.1.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
fd8ff0bc0b341fe5e691a12ea3d6fe35af26913912514830e053a9acfa4a5736
BLAKE2b-256 checksum
How to use checksums
f7d09ec6cd4913a726a19d7a9ff74e679bdad110b037f3f7e5ca5a0309200622
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / xycmap-1.0.1-py3-none-any.whl

Download URL xycmap-1.0.1-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
669652bd2049f251d713d73ae18694a4b6ef92f0f9a5c8092fc5bbd1f5fb50b8
BLAKE2b-256 checksum
How to use checksums
1c6c6bbe66d9e40d8c50552a7df4014f557ae3aa67b990a4fa3f56fd92d07204
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page