Michael Hearne wrote:
> I'm trying to understand the usage of Colormaps, 
> and LinearSegmentedColormaps in particular.
> 
> I can create segmentdata that looks like the example at the bottom of 
> this message.  Each color has a 3x9 list of values.
> 
> I can then construct a LinearSegmentedColormap as follows:
> palette = LinearSegmentedColormap('my_colormap',cdict)
> 
> the 'N' attribute of my palette object reports that the length of the 
> colormap is 256.  However, when I try to retrieve the color tuple for 
> any value above 50, I get black:
> 
> palette(51) => (0.0, 0.0, 0.0, 1.0)
> 
> Why aren't there 256 different colors in my colormap?
Because your color values state that for any normalized value between .2 
and 1, the color should be RGB = (0.0,0.0,0.0).  In your color 
dictionary, the first number of each tuple/list specifies a value 
between 0 and 1 to go with that color level.  You probably instead want 
to assign each color level to a level between 0 and 1.  ie. For 5 
levels, you want 0, .25, 0.5, 0.75, 1.0.

Ryan

> --Mike
> 
> cdict = {'blue': [[0.0, 1.0, 1.0],
>           [9.99999974738e-05, 0.749019622803, 0.749019622803],
>           [0.0010000000475, 0.623529434204, 0.623529434204],
>           [0.00200000009499, 0.498039215803, 0.498039215803],
>           [0.00999999977648, 0.372549027205, 0.372549027205],
>           [0.019999999553, 0.247058823705, 0.247058823705],
>           [0.10000000149, 0.121568627656, 0.121568627656],
>           [0.20000000298, 0.0, 0.0],
>           [1.0, 0.0, 0.0]],
>  'green': [[0.0, 1.0, 1.0],
>            [9.99999974738e-05, 0.749019622803, 0.749019622803],
>            [0.0010000000475, 0.623529434204, 0.623529434204],
>            [0.00200000009499, 0.498039215803, 0.498039215803],
>            [0.00999999977648, 0.372549027205, 0.372549027205],
>            [0.019999999553, 0.247058823705, 0.247058823705],
>            [0.10000000149, 0.121568627656, 0.121568627656],
>            [0.20000000298, 0.0, 0.0],
>            [1.0, 0.0, 0.0]],
>  'red': [[0.0, 1.0, 1.0],
>          [9.99999974738e-05, 0.749019622803, 0.749019622803],
>          [0.0010000000475, 0.623529434204, 0.623529434204],
>          [0.00200000009499, 0.498039215803, 0.498039215803],
>          [0.00999999977648, 0.372549027205, 0.372549027205],
>          [0.019999999553, 0.247058823705, 0.247058823705],
>          [0.10000000149, 0.121568627656, 0.121568627656],
>          [0.20000000298, 0.0, 0.0],
>          [1.0, 0.0, 0.0]]}
> 
> 
> 
> 
> 
> ------------------------------------------------------
> Michael Hearne
> [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
> (303) 273-8620
> USGS National Earthquake Information Center
> 1711 Illinois St. Golden CO 80401
> Senior Software Engineer
> Synergetics, Inc.
> ------------------------------------------------------
> 
> 
> 
> ------------------------------------------------------------------------
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to