Color schemes for lines and maps, color-blind safe
Project description
Tol_colors
Colormaps and qualitative colorsets that are colorblind-safe
Those color schemes were designed by Paul Tol. This repository is packaging his work so that it can be easily installed using pip. This package and its documentation follow his technical notes1, which are archived in this repository. Details and implementations for other languages can be found on Paul Tols's website.
A more user-friendly documentation is available at https://tol-colors.readthedocs.io, detailing how and when to use the various colorsets and colormaps in this package.
Install
Using pip:
pip install tol-colors
From source:
git clone https://github.com/Descanonge/tol_colors.git
cd tol_colors
pip install .
Show the available colorsets, colormaps, and the discrete rainbow colormap:
python -m tol_colors
Requirements
- numpy
- matplotlib
Discrete/qualitative schemes
Sets of colors that can be used for lines, markers, qualitative maps, etc. All colorsets are given as named tuples. You can then access the colors by index or by name:
>>> import tol_colors as tc
>>> cset = tc.bright
>>> cset.blue
'#4477AA'
Each colorset is available as a module attribute (tc.bright) or in the
dictionary tol_colors.colorsets. This is a special mapping that will accept
both hyphen and underscore versions (tc.colorsets["high-contrast"] and
tc.colorsets["high_contrast"] will both work).
This package also provides a function to easily set the default colors used by Matplotlib to one of the colorsets. This will change your matplotlibrc file or a given stylesheet file.
Colormaps
The following colormaps were created by linear interpolation of carefully chosen
colors. Those colors can be used as is for discrete colormaps. Discrete variants
are available by adding "_discrete" to the colormap name (eg
tc.sunset_discrete).
The iridescent colormap is meant to be used interpolated; you can still use
tc.iridescent.resampled(N) to obtain a discrete version. To obtain a discrete
rainbow colormap, use tc.rainbow_discrete(n_colors=14) with a number between 1
and 23.
Colormaps are available either:
- as module attributes (
tc.sunset), - stored in a dictionary (
tc.colormaps["sunset"]) which returns copies, - registered in matplotlib with the prefix "tol." (
plt.imshow(..., cmap="tol.sunset")).
Reversed variants are available by appending "_r" to the colormap name.
See also
Other packages already implement these colorschemes and might better suit your needs:
- color_tol
- pyplot-themes
- khroma: R package that includes those schemes
1: Colour Schemes, Paul Tol, SRON/EPS/TN/09-002, issue 3.2, 18 August 2021 ↩
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 tol_colors-2.2.0.tar.gz.
File metadata
- Download URL: tol_colors-2.2.0.tar.gz
- Upload date:
- Size: 1.9 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
212ff02e2fcf5c7f9cdb928ba1701bcfbf7fe7a24c52a838488e1db398115db6
|
|
| MD5 |
32a80717d5b922cd69ba618d97c15f1a
|
|
| BLAKE2b-256 |
2a18c4877a3dfd90a7350da789fb3e23f2a0a711eb13d56f3c9f6ce1aa9876b9
|
Provenance
The following attestation bundles were made for tol_colors-2.2.0.tar.gz:
Publisher:
pypi-publish.yml on Descanonge/tol_colors
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tol_colors-2.2.0.tar.gz -
Subject digest:
212ff02e2fcf5c7f9cdb928ba1701bcfbf7fe7a24c52a838488e1db398115db6 - Sigstore transparency entry: 814708920
- Sigstore integration time:
-
Permalink:
Descanonge/tol_colors@918fe57d25dc94b9e31efe7a44dcf79907c4ecec -
Branch / Tag:
refs/tags/v2.2.0 - Owner: https://github.com/Descanonge
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@918fe57d25dc94b9e31efe7a44dcf79907c4ecec -
Trigger Event:
release
-
Statement type:
File details
Details for the file tol_colors-2.2.0-py3-none-any.whl.
File metadata
- Download URL: tol_colors-2.2.0-py3-none-any.whl
- Upload date:
- Size: 12.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f9a13efbbdc9469ee73a4b497c2e7b2acd7e36ad78cfa5a227c1589826ae74f5
|
|
| MD5 |
a805b6ba6ac6fb6e317dd0aee07d1d51
|
|
| BLAKE2b-256 |
b671113f6baf45953f214f7de1a3cc1494fb0289641a93adc42ba78eaec5c513
|
Provenance
The following attestation bundles were made for tol_colors-2.2.0-py3-none-any.whl:
Publisher:
pypi-publish.yml on Descanonge/tol_colors
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tol_colors-2.2.0-py3-none-any.whl -
Subject digest:
f9a13efbbdc9469ee73a4b497c2e7b2acd7e36ad78cfa5a227c1589826ae74f5 - Sigstore transparency entry: 814708928
- Sigstore integration time:
-
Permalink:
Descanonge/tol_colors@918fe57d25dc94b9e31efe7a44dcf79907c4ecec -
Branch / Tag:
refs/tags/v2.2.0 - Owner: https://github.com/Descanonge
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@918fe57d25dc94b9e31efe7a44dcf79907c4ecec -
Trigger Event:
release
-
Statement type: