Hi, 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): self.mycolors.append(cmap(i)) mpl.axes.set_default_color_cycle(self.mycolors) Can anyone suggest a cleaner method? Or is there perhaps an existing class to provide distinct color lines? Thanks, Krishna -- 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. ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users