Nicopal: colour palettes designed for everyone.
Project description
Nicopal
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, ensuring consistent interpretation across all observers — regardless of their colour vision. Developed by a protanope (red colour deficiency) student, for everyone.
I. Installation
In a Python console or terminal :
pip install nicopal
II. Usage
0. Loading the package
import nicopal as ncp
1. Display the package version
print(ncp.version)
Displays the version and a very short description of the package.
2. Quickly test all palettes
print(ncp.pal_test())
Checks that all palettes load correctly. Displays a confirmation message if everything is valid
3. List available palettes
print(ncp.pal_list())
Displays all available palette names in Nicopal.
4. Visualize a palette
print(ncp.pal_show("Lithium"))
Displays a gradient of the chosen palette.
pal_show can be used with any palette from pal_list().
5. Visualiser toutes les palettes
print(ncp.pal_all())
Displays all palettes and their associated names.
6. Charger une palette en liste HEX
print(ncp.pal_hex("Lithium"))
Returns the palette as the corresponding HEX color codes.
7. Use a palette as a colormap
colormap = ncp.pal("Lithium")
colormap_r = ncp.pal("Lithium", reverse=True)
ax.contourf(x, y, z, cmap=colormap)
reverse=Trueallows the colormap to be reversed.
ax.contourfcan be replaced by any other Matplotlib function that accepts a colormap.
x,yandzare your data to visualize.
8. Extract colors from a palette
sample = ncp.pal_sample("Carbon", 6)
x = ["A","B","C","D","E","F"]
y = [3,7,5,6,4,8]
plt.bar(x, y, color=sample)
plt.show()
Returns n discrete colors extracted from the palette.
9. Palette demonstration
print(ncp.pal_demo("Lithium"))
Displays example visualizations using the chosen palette
10. Palette names
Boron | Carbon | Cesium | Chlorine | Cobalt | Iodine | Iridium | Iron | Lithium | Magnesium | Manganese | Mercury | Neon | Nickel | Nitrogen | Osmium | Oxygen | Radium | Rubidium | Selenium | Silicon | Silver | Sodium | Sulfur | Uranium | Vanadium | Zinc |
III. Methodology
Documentation in progress...
Bibliography :
[1] Crameri, Fabio, Grace E. Shephard, and Philip J. Heron. 2020. ‘The Misuse of Colour in Science Communication’. Nature Communications 11(1): 5444. doi:10.1038/s41467-020-19160-7.
:) NT
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 nicopal-0.5.0.tar.gz.
File metadata
- Download URL: nicopal-0.5.0.tar.gz
- Upload date:
- Size: 521.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b69b78deffc2ea5b1cf82c85b42630c9272a95dd89a16ef8baf0f15fbac1052
|
|
| MD5 |
abafd4efbe8f1bba78f7527692b5ffa9
|
|
| BLAKE2b-256 |
7ca80f2763aafba8fda46cf2d0c23e9f1556d6d01e192dea34e2b2b9b9484d47
|
File details
Details for the file nicopal-0.5.0-py3-none-any.whl.
File metadata
- Download URL: nicopal-0.5.0-py3-none-any.whl
- Upload date:
- Size: 500.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
872ab75eb2e78c57d3ee56d240537487ab2395715924a29f31788d8865b47940
|
|
| MD5 |
25a71a91760bf102b325abe7386b1895
|
|
| BLAKE2b-256 |
bbf55da1000b6634aacbd0b039c9a4232682f2ef92ba2650a542ac40240225d7
|