Need help on configuration of a Cmap

Hello,

I want to creat a cmap to show a matrix. I don’t know if what i want is possible, my aim is to have a cmap that respect :

  • from 0 to 0.5 pure white
  • from 0.5 to 1 pure black
  • from 1 to ∞ a gradient from green to red

I would love to know if a such thing is possible
Thank you !

There are many examples of creating colormaps at
https://matplotlib.org/stable/tutorials/colors/colormap-manipulation.html
and
https://matplotlib.org/stable/gallery/color/custom_cmap.html
Some of which are blocks of colours, and some of which are gradients. You will probably have to mix a few of them together to achieve what you want.

This bit is impossible though, since there are an infinite number between 1 and ∞ and only a finite number of possible renderable colours. You will have to figure out a way to normalize that range first.