Skip to main content

Nicopal: colour palettes designed by a protanopic student.

Project description

Nicopal

Context

These color palettes were created by Nicolas Tharaud inspired by the method of Fabio Crameri [1]. Their purpose is to represent climatic variables as accurately as possible, without visual mis-interpretation. A color palette must be careffuly chosen according to the variable being represented, so that it is interpreted in the same way by every observer. The color palettes were created by a protanope color-blind student (red color deficiency). Furthermore, the contrast of some palettes will be more visible to a protanope color-blind person than to someone with "normal" vision or a different type of color blindness, and vice versa.


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=True allows the colormap to be reversed.
ax.contourf can be replaced by any other Matplotlib function that accepts a colormap.
x, y and z are 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 | Iron | Lithium | Magnesium | Manganese | Neon | Nitrogen | Oxygen | Rubidium | Selenium | Silicon | 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


Download files

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

Source Distribution

nicopal-0.4.5.tar.gz (404.8 kB view details)

Uploaded Source

Built Distribution

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

nicopal-0.4.5-py3-none-any.whl (388.4 kB view details)

Uploaded Python 3

File details

Details for the file nicopal-0.4.5.tar.gz.

File metadata

  • Download URL: nicopal-0.4.5.tar.gz
  • Upload date:
  • Size: 404.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.12

File hashes

Hashes for nicopal-0.4.5.tar.gz
Algorithm Hash digest
SHA256 cf9258211c6dbb2defbb1d8ea13afe18eb524badf6fd094cfb546c9eb345475d
MD5 b973b58b34c2794d817c4b876f8ae695
BLAKE2b-256 96ce60d9775a2845035e1d49267e0c03795258145778d6da06acf153b53f1fbc

See more details on using hashes here.

File details

Details for the file nicopal-0.4.5-py3-none-any.whl.

File metadata

  • Download URL: nicopal-0.4.5-py3-none-any.whl
  • Upload date:
  • Size: 388.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.12

File hashes

Hashes for nicopal-0.4.5-py3-none-any.whl
Algorithm Hash digest
SHA256 cdbce16585456b384584da256b45e33f3b10ea6332ea3a7102ae22b448470ba4
MD5 c2f41756cd9271e7ad6053878deaab55
BLAKE2b-256 ab0feb0905802f7504c4799d12c7c414a760db3755504949d11f6b59cde7f1c7

See more details on using hashes here.

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