Hi, I'd like to use the colormap interface in a different
> way than it's used in plotting images. I am plotting a
> series of curves (using regular old plot), each of which
> corresponds to the behavior of a biological circuit under a
> different level of "inducer", ranging from around 0-100. I
> want to assign the color of each line according to the
> inducer value, and I want to try out different colormaps to
> see which I like best.
> All I really want is a method that, for a given colormap
> (jet, pink, hot, hsv, etc), takes a number between 0,1 as
> input and returns the corresponding RGB value, which I can
> then use a 'color' argument in a plotting command. (I was
In [6]: import matplotlib.cm as cm
In [7]: cm.jet(.5)
Out[7]: (0.49019607843137247, 1.0, 0.47754585705249841, 1.0)
> sort of hoping that the colormap object itself would provide
> such a method but I couldn't find any description of it's
> interface).
The class documentation is available at
http://matplotlib.sourceforge.net/classdocs.html
in particular, take a look at
http://matplotlib.sourceforge.net/matplotlib.colors.html#LinearSegmentedColormap
"jet" in the example above, is an instance of the
LinearSegmentedColormap colormap class, and the __call__ method
returns the data you are interested in for scalars or sequences.
JDH