matplotlib / cmocean

Colormap setup for standardizing commonly-plotting oceanographic variables.
MIT License
230 stars 52 forks source link

cmap alteration #62

Closed stefraynaud closed 6 years ago

stefraynaud commented 7 years ago

I plan to use your colormaps as much as possible. However, it is for instance hard to draw lines onto filled objects since the colormaps goes generally from very dark to very white, or the reverse: black lines or white lines or texts are not that visible around extremess.

How about the possibility to alterate a colormap when calling the cmap() function, keeping them perceptually uniform. Here is probably an example of alteration that allow to plot dark lines that are always visible: http://www.ifremer.fr/vacumm/tests/test_color_whiten.html

kthyng commented 6 years ago

I have finally addressed this with commit 00ac1317f0f917f6f91dbd0b4c89384e68f57410, which is now integrated. It is in the function cmocean.tools.lighten.

Note that depending on what you are plotting with, you could alternatively input an alpha value to lighten your plot, but this function allows you to change the alpha value of the colormap itself to make it transparent.