[Matplotlib-users] New colormaps : Inferno, Viridis, ...

Aston630 gael.grissonnanche1 at gmail.com
Fri Dec 11 12:29:08 EST 2015


Hi,

I wanted to try today the new exciting colormaps that come with the 1.5.0
version of Matplotlib. I quickly discovered I could not use them the same as
the previous colormaps. Indeed, in the past I used to do:

import matplotlib as mpl
cmap = mpl.cm.get_cmap("jet", nb_curves)

# where cmap is LinearSegmentedColormap and from there get the colors the
following way in order to 
# handle them the way I wanted for a set of curves or points or arrows
etc... :
colors = cmap(np.arange(nb_curves))

Now with the new colormaps I do the same:

import matplotlib as mpl
cmap = mpl.cm.get_cmap("inferno", nb_curves)

where cmap is now a ListedColormap and I cannot do what I used to do before.

My first question would be : why this difference between old and new
colormaps?
Then, is there a way I could get a LinearSegmentedColormap from Inferno,
Viridis, etc... ? This is really what I want.

Thanks a lot for your time and considering this issue!



--
View this message in context: http://matplotlib.1069221.n5.nabble.com/New-colormaps-Inferno-Viridis-tp46530.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


More information about the Matplotlib-users mailing list