Simulate colorblindness in Python charts
Project description
realcolor: simulate colorblindness in Python charts
realcolor is a lightweight Python package designed to show how colorblind people see your graphs. It simulates all types of colorblindness (deuteranopia, protanopia, tritanopia) by showing you your graphic as seen by a colorblind person. It works with matplotlib and everything built on top of it (seaborn, plotnine, etc).
[!NOTE] Colorblindness affects up to 1 in 12 males (8%) and 1 in 200 females (0.5%)[^1]
Installation
pip install git+https://github.com/y-sunflower/realcolor.git
Quick start
Matplotlib
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.plot([1, 2, 3], [4, 2, 5], label="Group A", lw=4)
ax.plot([1, 2, 3], [2, 5, 3], label="Group B", lw=4)
ax.legend()
from realcolor import simulate_colorblindness
simulate_colorblindness(fig)
Plotnine
from plotnine import ggplot, geom_point, aes
from plotnine.data import anscombe_quartet
ggp = ggplot(anscombe_quartet, aes(x="x", y="y", color="dataset")) + geom_point(size=10)
from realcolor import simulate_colorblindness
simulate_colorblindness(ggp)
[!TIP] Looking for support of other data visualization libraries? Open an issue.
[^1]: Deane B. Judd, "Facts of Color-Blindness*," J. Opt. Soc. Am. 33, 294-307 (1943)
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 realcolor-0.1.0.tar.gz.
File metadata
- Download URL: realcolor-0.1.0.tar.gz
- Upload date:
- Size: 319.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7dc728a09ba9ca4257f551ca5a76f64c43364df8e66353383964e4c7da72fbb8
|
|
| MD5 |
306d61d2f221062e3e0868d0424f0ab5
|
|
| BLAKE2b-256 |
3a7e16da7586dc4e55d06c69a6603d8ea39ec6bbe66a8ec9fe2512fe1f2eb5a0
|
Provenance
The following attestation bundles were made for realcolor-0.1.0.tar.gz:
Publisher:
pypi.yaml on y-sunflower/realcolor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
realcolor-0.1.0.tar.gz -
Subject digest:
7dc728a09ba9ca4257f551ca5a76f64c43364df8e66353383964e4c7da72fbb8 - Sigstore transparency entry: 928446093
- Sigstore integration time:
-
Permalink:
y-sunflower/realcolor@584c0186162e583b514340e017af7b4c342d100e -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/y-sunflower
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yaml@584c0186162e583b514340e017af7b4c342d100e -
Trigger Event:
push
-
Statement type:
File details
Details for the file realcolor-0.1.0-py3-none-any.whl.
File metadata
- Download URL: realcolor-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.4 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 |
204a2396c7ccaf36292e12a4fad95d225504a18872ca3dff7601541ce0a17cd0
|
|
| MD5 |
ea4d83bd1996852f68c787ccb76c488c
|
|
| BLAKE2b-256 |
d30c0dd14978657af0110240df090c63048d4d9866e80c85071c5be2d9250f51
|
Provenance
The following attestation bundles were made for realcolor-0.1.0-py3-none-any.whl:
Publisher:
pypi.yaml on y-sunflower/realcolor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
realcolor-0.1.0-py3-none-any.whl -
Subject digest:
204a2396c7ccaf36292e12a4fad95d225504a18872ca3dff7601541ce0a17cd0 - Sigstore transparency entry: 928446095
- Sigstore integration time:
-
Permalink:
y-sunflower/realcolor@584c0186162e583b514340e017af7b4c342d100e -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/y-sunflower
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yaml@584c0186162e583b514340e017af7b4c342d100e -
Trigger Event:
push
-
Statement type: