Skip to main content

Nicopal

PyPI Python License Colorblind Friendly

1. Context

Nicopal provides perceptually uniform and colour-vision-deficiency-friendly colour palettes for scientific data visualisation. Inspired by the work of Fabio Crameri [1], these palettes are designed to represent data as faithfully as possible. They comprise both palettes specifically developed for particular types of colour vision deficiency and palettes that are perceptually accessible across the full spectrum of colour vision. Their design follows the perceptual uniformity guidelines of Peter Kovesi [2] and uses the colour-vision deficiency simulation model of Machado et al. [3]. They are also part of the broader effort, initiated as early as 2004 by Light & Bartlein [4], to move away from rainbow-type colourmaps, which are known to introduce perceptual artefacts and mislead interpretation.

However, this package offers you the possibility to easily manipulate colourmaps with practical functions to design your best scientific colour-blind-friendly figures! For more context on colourmap best practices, see the colourmap selection flowchart and the work of Masataka Okabe & Kei Ito.

Developed by a protanope (red colour deficiency) PhD student, for everyone.


2. Installation

In a Python console or terminal:

pip install nicopal             

3. Usage

3.0 Nicopal palettes

Type Name
Sequential Arsenic - Boron - Carbon - Caesium - Chlorine - Iodine - Iridium - Krypton - Magnesium - Manganese - Neon - Nitrogen - Oxygen - Radium - Selenium - Silver - Tin - Uranium - Xenon - Zinc
Diverging Cobalt - Hydrogen - Iron - Mercury - Nickel - Osmium - Rubidium - Silicon - Sulfur - Vanadium
Other Lithium - Sodium
Nicopal Palettes

3.1 Loading the package

import nicopal as ncp


3.2 Basic functions

Function Description
print(ncp.version) Displays the package version and information.
ncp.pal_test() Checks that all palettes load correctly.
ncp.pal_list() Returns the list of available palettes.
ncp.pal_hex("Carbon", N=10) Returns a list of HEX colour codes.

For more information on HEX colour formats, see the Matplotlib documentation.


3.3 Visualising palettes

Function Description
ncp.pal_show("Vanadium") Displays a gradient of the chosen palette.
ncp.pal_all() Displays all available palettes with their names.
ncp.pal_demo("Radium") Displays various types of plots using the specified colour palette.
ncp.pal_demo_advanced("Osmium") Includes additional visualisations, such as map-based examples.

The advanced demonstration requires scipy and cartopy. Install them using: pip install nicopal'[advanced]'
These dependencies are optional and are not required for standard Nicopal functionality.

Examples: Results of ncp.pal_all(), ncp.pal_demo("Radium") and ncp.pal_demo_advanced("Osmium"), respectively.

Nicopal Palettes

3.4 Use a palette as a colourmap

Basic usage

cmap = ncp.pal("Xenon")

Nicopal Palettes

Reversing a colourmap

cmap_r = ncp.pal("Xenon_r")
cmap_r = ncp.pal("Xenon", reverse=True)

Nicopal Palettes

Dark or Light centre for diverging palettes

cmap = ncp.pal("Nickel", center="Dark")
cmap = ncp.pal("Nickel", center="Light")

Nicopal Palettes Nicopal Palettes

Additional information

Palette names are case-insensitive: "xenon", "Xenon" and "XENON" all work.
Center names are also case-insensitive: "Dark", "d", "D", "Black", "k", "K", "Light", "l", "L", "White", "w", "W" all work.

For more information on reversing and manipulating colourmaps, see the Matplotlib colourmap manipulation guide.


3.5 Useful functions

Function Description
ncp.pal_multiseq("Oxygen", "Silver") Combines two sequential palettes to create a multisequential colourmap.
ncp.pal_sample("Carbon", 6) Extracts n evenly spaced discrete colours from a palette.
ncp.pal_badge() Displays an overview of palette accessibility badges and their explanations.
ncp.pal_badge("Zinc") Displays the accessibility badge for a specific palette.

Examples:

Multisequential palette:
Nicopal Palettes

Sampled colour map:

import nicopal as ncp
import matplotlib.pyplot as plt
x = ["A", "B", "C", "D", "E", "F"]
y = [3, 7, 5, 6, 4, 8]
sample = ncp.pal_sample("Carbon", 6)
plt.bar(x, y, color=sample)
plt.show()
Nicopal palette sample

4. Bibliography :

[1] Crameri, F., Shephard, G.E. & Heron, P.J. 2020. 'The Misuse of Colour in Science Communication'. Nature Communications 11(1): 5444. doi:10.1038/s41467-020-19160-7. Paper link

[2] Kovesi, P. 2015. 'Good Colour Maps: How to Design Them'. arXiv:1509.03700. Paper link

[3] Machado, G.M., Oliveira, M.M. & Fernandes, L.A.F. 2009. 'A Physiologically-based Model for Simulation of Color Vision Deficiency'. IEEE Transactions on Visualization and Computer Graphics 15(6): 1291–1298. doi:10.1109/TVCG.2009.113. Paper link

[4] Light, A., and P. J.Bartlein (2004), The end of the rainbow? Color schemes for improved data graphics, Eos Trans. AGU, 85(40), 385–391, doi:10.1029/2004EO400002. Paper link


5. Citation

If you use Nicopal in scientific publications, please cite the package.

Suggested acknowledgement

This work uses the Nicopal colour palettes developed by Nicolas Tharaud.


:) NT


Metadata

Release files for nicopal 1.0.0

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

Source distribution (sdist)

Source distribution for nicopal 1.0.0
File Size Uploaded Provenance Actions
nicopal-1.0.0.tar.gz 1.7 MB Without provenance Details for nicopal-1.0.0.tar.gz

Built distribution (wheel)

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

Total release size: 3.3 MB

Release files / nicopal-1.0.0.tar.gz

Download URL nicopal-1.0.0.tar.gz
Size 1.7 MB
Tags Source
SHA-256 checksum
How to use checksums
3314afd4464affe60da1936a209613e0c717989061313a937caca6c72fc0de57
BLAKE2b-256 checksum
How to use checksums
cea96d4d625d4b7d94cdd06f7533345d26fb8a13b17fcdc55d645b44157a9e91
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.12

Release files / nicopal-1.0.0-py3-none-any.whl

Download URL nicopal-1.0.0-py3-none-any.whl
Size 1.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
03533e9c85eef2298f64ef73e6989a5daea17976d5c7c27ea3a3ca956cbfb51d
BLAKE2b-256 checksum
How to use checksums
af292ded93146dfe7b004dd496b083a0b57a07dc1b96b3ca1200b6fb50fb97bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.12

Security for nicopal 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

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