I'm trying to plot a set of lines, 12 to be exact, and the default color
cycle only supports 8 or 9 distinct colors. That said, I looked up the color
maps and segmented it using 12 constant intervals with the hope of getting
12 distinct colors.
The problem I'm running in to is that some of the line colors I get are too
close to each other. This is because come shades in the colormap have a
broader spectrum than others.
Here is my code to set my custom default color cycle:
import matplotlib as mpl
cmap = mpl.cm.get_cmap(name='spectral') #I gues we can also use
"hsv" or "gist_rainbow"
nColors = 12 #number of colors
incr = 0.9 / nColors
self.mycolors = 
for i in np.arange(0,0.9,incr):
Can anyone suggest a cleaner method? Or is there perhaps an existing class
to provide distinct color lines?
View this message in context: http://old.nabble.com/custom-color-cycle-from-cmap-tp28177653p28177653.html
Sent from the matplotlib - users mailing list archive at Nabble.com.