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 | 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


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.7.tar.gz (521.4 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.7-py3-none-any.whl (500.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nicopal-0.4.7.tar.gz
  • Upload date:
  • Size: 521.4 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.7.tar.gz
Algorithm Hash digest
SHA256 2ea4b263fe800648701ba96529b213adeec65d2c693579cee60678bd999f6af1
MD5 32619a62a000922b29812a448143f8aa
BLAKE2b-256 0528a71f2e15ffdd5facc2a236db7a1ba519d6e55bed4c63f095580ddf361d87

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nicopal-0.4.7-py3-none-any.whl
  • Upload date:
  • Size: 500.7 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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 a8625935f68ce86e07c13e5d9a42cf009bdf33cba3d7b5d915cd3e166d37cad0
MD5 92443930aceff2a9388767d52f9677e7
BLAKE2b-256 a8eeb3c83a2ed7402d149a3513d1725676aebd569de559db33eb40f0c7e1cc65

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