Colorblind friendly colormaps and color cycles for matplotlib
Project description
cblind
A colorblind-friendly python module that allows color choice for plotting multiple curves 8 colormaps are now available to map 2D fields Authors: Gaylor Wafflard-Fernandez, Clément Robert Author-email: gaylor.wafflard@univ-grenoble-alpes.fr
Installation
Install with pip
pip install cblind
To import cblind:
import cblind as cb
Usage for plotting
10 palette functions to plot curves are available for now in the Colorplots class, with the corresponding test plotting functions.
cblind
color, linestyle = cb.Colorplots().cblind(nb_of_plots)
from 1 to 12 plots [DISTINCT COLORS]. For more than 12 plots, the linestyle is changed.
cb.test_cblind(nb_of_plots)
contrast
color, linestyle = cb.Colorplots().contrast(nb_of_plots)
for less than 4 contrast plots [DISTINCT COLORS]. For more than 12 plots, the linestyle is changed.
cb.test_contrast(nb_of_plots)
huescale
color, linestyle = cb.Colorplots().huescale(nb_of_plots, *option)
from 1 to 9 plots [SEQUENTIAL DATA]. With option "blue","bluegreen","green", "gold","brown","rose","purple" for less than 3 plots, otherwise ocherscale.
cb.test_huescale(nb_of_plots, *option)
rbscale
color, linestyle = cb.Colorplots().rbscale(nb_of_plots)
from 3 to 11 plots [DIVERGING DATA].
cb.test_rbscale(nb_of_plots)
rainbow
color, linestyle = cb.Colorplots().rainbow(nb_of_plots)
from 4 to 12 plots [RAINBOW SCHEME].
cb.test_rainbow(nb_of_plots)
extreme_rainbow
color, linestyle = cb.Colorplots().extreme_rainbow(nb_of_plots)
from 1 to 34 plots [RAINBOW SCHEME].
cb.test_extreme_rainbow(nb_of_plots)
solstice
color, linestyle = cb.Colorplots().solstice(nb_of_plots)
for less than 11 plots [DIVERGING DATA]
cb.test_solstice(nb_of_plots)
bird
color, linestyle = cb.Colorplots().bird(nb_of_plots)
for less than 9 plots [DIVERGING DATA]
cb.test_bird(nb_of_plots)
pregunta
color, linestyle = cb.Colorplots().pregunta(nb_of_plots)
for less than 9 plots [DIVERGING DATA]
cb.test_pregunta(nb_of_plots)
monocolor
color, linestyle = cb.Colorplots().monocolor(nb_of_plots, *option)
from 1 to 13 monochromatic plots [MONOCOLOR/PRINTING] with different linestyles. With option "b&w", "blue", "red", "yellow", "green", "purple".
cb.test_monocolor(nb_of_plots, *option)
Usage for colormaps
8 cblind palettes are available for now : "cb.rbscale", "cb.rainbow", "cb.extreme_rainbow", "cb.huescale", "cb.solstice", "cb.bird", "cb.pregunta", "cb.iris", but also all colormaps from matplotlib + "_r" variants for reverse colormaps.
cmap = cb.cbmap(palette, nbin)
The nbin argument is used to discretize the colormaps.
To test the colormaps, you can try:
cb.test_mapping(palette, nbin)
Example with a field data2d
import numpy as np
import matplotlib.pyplot as plt
data2d = np.repeat(np.linspace(0,1,100),20).reshape(100,20).T
fig, ax = plt.subplots()
im = ax.imshow(data2d, cmap=cb.cbmap("cb.rainbow_r", nbin=10), aspect='auto')
fig.colorbar(im)
plt.show()
Basic mapping function
cb.mapping(fig,ax,data2d,extent,palette=palette,nbin=nbin)
REFERENCE Paul Tol. 2012. "Colour Schemes." SRON Technical Note, SRON/EPS/TN/09-002. https://personal.sron.nl/~pault/data/colourschemes.pdf
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cblind-2.3.2.tar.gz.
File metadata
- Download URL: cblind-2.3.2.tar.gz
- Upload date:
- Size: 21.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e120c6fa3741a2000eecb57c42b0ded400da6619a0ae7be86b085d602bf6b67e
|
|
| MD5 |
7af1faab0fa23efd0c52b0aa524123ea
|
|
| BLAKE2b-256 |
e36063c98d02e4bc4f3c107d819dd467daa16d820896f7bae9c950faaf15302d
|
Provenance
The following attestation bundles were made for cblind-2.3.2.tar.gz:
Publisher:
cd.yml on la-niche/cblind
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cblind-2.3.2.tar.gz -
Subject digest:
e120c6fa3741a2000eecb57c42b0ded400da6619a0ae7be86b085d602bf6b67e - Sigstore transparency entry: 464853904
- Sigstore integration time:
-
Permalink:
la-niche/cblind@fe6a5229cdfe01d13e748bc1c7ba8a17d18b9f4d -
Branch / Tag:
refs/tags/v2.3.2 - Owner: https://github.com/la-niche
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@fe6a5229cdfe01d13e748bc1c7ba8a17d18b9f4d -
Trigger Event:
push
-
Statement type:
File details
Details for the file cblind-2.3.2-py3-none-any.whl.
File metadata
- Download URL: cblind-2.3.2-py3-none-any.whl
- Upload date:
- Size: 20.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da7e2ccfcc556495570cfc23d8d3f5fa954eb01ad7e18735b062810b1b18e39f
|
|
| MD5 |
87ad4efbf171958cdc580018e27bc8f9
|
|
| BLAKE2b-256 |
c106ae7aee4860ba12cf50b8fc5678e13cc5775fac9fbf8cd36355dc25288ff5
|
Provenance
The following attestation bundles were made for cblind-2.3.2-py3-none-any.whl:
Publisher:
cd.yml on la-niche/cblind
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cblind-2.3.2-py3-none-any.whl -
Subject digest:
da7e2ccfcc556495570cfc23d8d3f5fa954eb01ad7e18735b062810b1b18e39f - Sigstore transparency entry: 464853933
- Sigstore integration time:
-
Permalink:
la-niche/cblind@fe6a5229cdfe01d13e748bc1c7ba8a17d18b9f4d -
Branch / Tag:
refs/tags/v2.3.2 - Owner: https://github.com/la-niche
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@fe6a5229cdfe01d13e748bc1c7ba8a17d18b9f4d -
Trigger Event:
push
-
Statement type: