Michael Hearne wrote:
> Ryan - Thanks for your response.
> 
> Shouldn't a color dictionary have 4 "columns" - a value, and the 
> corresponding R,G,B values?  If I understand your response, the "row" 
> with 0.2 as the first column has only two values.  How does 
> LinearSegmentedColormap derive an RGB triplet from those two numbers?
> 

Not quite.  I'm pretty sure I was a little vague in my last message, so 
let me be more concrete.  Here's an example of a 5 gray level color map 
data dictionary:

_Gray5_data = {'blue': [(0.0, 0.42352941176470588, 0.42352941176470588),
  (0.25, 0.53333333333333333, 0.53333333333333333),
  (0.5, 0.6588235294117647, 0.6588235294117647),
  (0.75, 0.81568627450980391, 0.81568627450980391),
  (1.0, 0.93725490196078431, 0.93725490196078431)],
  'green': [(0.0, 0.42352941176470588, 0.42352941176470588),
  (0.25, 0.53333333333333333, 0.53333333333333333),
  (0.5, 0.6588235294117647, 0.6588235294117647),
  (0.75, 0.81568627450980391, 0.81568627450980391),
  (1.0, 0.93725490196078431, 0.93725490196078431)],
  'red': [(0.0, 0.42352941176470588, 0.42352941176470588),
  (0.25, 0.53333333333333333, 0.53333333333333333),
  (0.5, 0.6588235294117647, 0.6588235294117647),
  (0.75, 0.81568627450980391, 0.81568627450980391),
  (1.0, 0.93725490196078431, 0.93725490196078431)]}

Note that the dictionary contains one list each for red, green, and 
blue.  Each entry in the a list for the color corresponds to an entry in 
the table.  This entry has 3 pieces of information:  The first (item #1) 
is the corresponding normalized data value for this color (between 0 and 
1).  The next two values are normalized color values, the first if the 
actual data value is below the value in item #1 and the 2nd if it is 
above. In the case of the one above, the color is the same regardless.

So, for example, a normalized data value of 0.25 gets an RGB tuple of 
(0.5333,0.5333,0.5333).

HTH,

Ryan

-- 
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