Skip to content Skip to sidebar Skip to footer

Select Starting Color In Matplotlib Colormap

I have the figure shown below. Presently the figure's colorscheme uses the entire range of the colormap (mpl.cm.Paired). What I want to do, and have been unable to figure out, is h

Solution 1:

One way to do this would be to call the function mpl.cm.Paired() for a subset of the normalised range (i.e., [0-1]) and then use the list of colors that it returns to define a new colormap:

import matplotlib.colors as mcol

lvTmp = np.linspace(0.1,1.0,len(levels)-1)
cmTmp = mlp.cm.Paired(lvTmp)
newCmap = mcol.ListedColormap(cmTmp)

You'll need to fiddle about with the 0.1 value in that linspace to get the start color that you want from the built in colormap.

enter image description here

Post a Comment for "Select Starting Color In Matplotlib Colormap"