Matplotlib Color Palette
matplotlib
Solution
The colors are extracted from color maps. You can use one of the predefined colormaps, or define your own.
Unfortunately there is no way to use multiple colormaps per figure, you have to do it manually:
import pylab as pl
import matplotlib.cm as cm
xval = pl.arange(0, 20, 0.2)
pl.subplot(311)
pl.plot(xval, pl.sin(xval), c=cm.summer(0))
pl.subplot(312)
pl.plot(xval, pl.cos(xval), c=cm.spring(0))
pl.subplot(313)
pl.plot(xval, pl.arctan(xval), xval, pl.fabs(xval))
pl.show()
Problem
Is it possible to change what colors Matplotlib cycles through when it is generating its own colors for a graph's lines? I'm using the pylab module. ``` from pylab import * import matplotlib.cm as cm x=[1,2,3,4] y=[5,6,7,8] fig1 = Figure() plot1 = fig1.add_subplot(311) plot1.plot(x,y) plot2 = fig1.add_subplot(312) plot2.plot(x,y) plot3 = fig1.add_subplot(313) plot3.plot(x,y) ```