Hello Eric,

The functions that I've created make it possible to generate a discrete 
(piecewise-constant) or continuous (piecewise-linear) colormap and 
register it at a single shot.  These functions also accept a list of 
thresholds if the user wants to specify non-default thresholds.  It 
seems as though the best alternatives require multiple steps and a 
considerable amount of fiddling.  Furthermore, my functions are 
thoroughly documented, while the alternatives are not.  I've found that 
it often takes less time to write something myself than to figure out 
how to use an undocumented function (which may not even do what I 
need).  If you agree that my functions provide a better interface, then 
I hope that you and John Hunter can get them incorporated into matplotlib.

Yours,

Phillip

Eric Firing wrote:
> Dr. Phillip M. Feldman wrote:
>> After experimenting with colormaps for a while, I was able to make both
>> discrete (piecewise-constant) and continuous (piecewise-linear) 
>> colormaps
>> work. Although colormaps can be created directly using
>> LinearSegmentedColormap from the matplotlib.colors package, this is a
>> tedious and error-prone process. So, I compiled a set of three interface
>> functions. (I wrote two of these myself, and got one from the SciPy
>> website). The two functions that I wrote permit one to define a discrete
>> (piecewise-constant) and continuous (piecewise-linear) colormap 
>> directly via
>> a sequence of colors and a set of thresholds specified as lists. Each 
>> color
>> may be specified either via an RGB tuple or via an English color name 
>> known
>> to webcolors.name_to_rgb. I'm going to submit all of this to the 
>> matplotlib
>> developers forums in the hopes of getting it incorporated into 
>> matplotlib.
>
> Something I should have mentioned earlier: for the discrete case, one 
> good option is to use a ListedColormap to make a map with only a few 
> colors, and then use a BoundaryNorm to handle the mapping from data 
> values to colors.  See 
> http://matplotlib.sourceforge.net/examples/pylab_examples/image_masked.html?highlight=image_masked
>  
>
> for a BoundaryNorm example.  Unfortunately, we don't have an example 
> of using it with a ListedColormap, but it should be straigtforward; 
> the key point is to set the BoundaryNorm ncolors kwarg to match the 
> actual number of colors in the colormap.
>
> Eric
>


------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to