From: Perry G. <pe...@st...> - 2005-01-06 20:01:42
|
Yes, colormaps are callable so you can call the colormap with either a scalar value or an array of values and what will be returned is a tuple of rgba values or an array (shape = 4, nelements). See the docstring on __call__ for LinearSegmentedColormap in colors.py Perry On Jan 6, 2005, at 3:18 PM, Carol Leger wrote: > I am using fill to make filled polygons. I want to fill the polygons > with colors that reflect data values, similar to what imshow does. > > Is there a way to extract the rgb tuples from a Colormap? This could > be an array of N tuples, each tuple containing 3 0-1 floats that > describe the color or three separate arrays, one each for red, green > and blue. > > I made the mistake of using some non-public attributes of the class > colorMap to accomplish this in a previous version of matplotlib. That > was a mistake since Colormap._red_lut, Colormap._green_lut and > Colormap._blue_lut no longer exist. > > Once I have the array of tuples, I can determine which one I want and > create a hex string using rgb2hex to get a color suitable for use with > fill. > > I need the flexability to make the same plot using several different > color maps. > -- > Ms. Carol A. Leger > SRI International Phone: (650) 859-4114 > 333 Ravenswood Avenue G-273 > Menlo Park, CA 94025 e-mail: le...@sr... > > > ------------------------------------------------------- > The SF.Net email is sponsored by: Beat the post-holiday blues > Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. > It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |