Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

realcolor-0.1.0.tar.gz (319.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

realcolor-0.1.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

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

Hashes for realcolor-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7dc728a09ba9ca4257f551ca5a76f64c43364df8e66353383964e4c7da72fbb8
MD5 306d61d2f221062e3e0868d0424f0ab5
BLAKE2b-256 3a7e16da7586dc4e55d06c69a6603d8ea39ec6bbe66a8ec9fe2512fe1f2eb5a0

See more details on using hashes here.

Provenance

The following attestation bundles were made for realcolor-0.1.0.tar.gz:

Publisher: pypi.yaml on y-sunflower/realcolor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for realcolor-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 204a2396c7ccaf36292e12a4fad95d225504a18872ca3dff7601541ce0a17cd0
MD5 ea4d83bd1996852f68c787ccb76c488c
BLAKE2b-256 d30c0dd14978657af0110240df090c63048d4d9866e80c85071c5be2d9250f51

See more details on using hashes here.

Provenance

The following attestation bundles were made for realcolor-0.1.0-py3-none-any.whl:

Publisher: pypi.yaml on y-sunflower/realcolor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page