David,

There is no such API--maybe we should add some methods to the base 
Colormap so there would be--but you can do it yourself in either of two 
ways.

First, you can generate a colormap from a list of colors, and the colors 
can be rgb triplets, so you could make your Nx3 array, do whatever you 
want with it, and then turn it into a colormap by using it to initialize 
a ListedColormap.  (The ListedColormap accepts an Nx3 array, or a list 
of any valid mpl colorspecs.)

Second, if you have any existing mpl Colormap instance, you can directly 
manipulate the _lut attribute; it is an ndarray and its dimensions are 
(N+3)x4.  You might want to manipulate only the [:N,:3] subarray of it. 
  The leading underscore means this attribute is not intended for user 
manipulation--but there is nothing to stop you from doing it in a pinch 
if necessary.

Eric

David Goldsmith wrote:
> Hi.  Making progress.  Caveat for what follows: the last version of Matlab I 
> used was like 6 or 7, I think - it's been a little while - so for all I know, 
> the colormap manipulation API I've been able to discover in the current MPL 
> does correspond closely to the same thing in the current Matlab.  That said, 
> said MPL colormap API is much more "powerful" (and consequently complicated) 
> than I need, at least for right now. :-)  Is there a set of tools I'm not 
> finding, or perhaps a third-party add-on, that enables more Matlab-like 
> colormap manipulation?  For example, I'm use to a (Matlab) colormap simply 
> being an Nx3 array of N RGB triples (or at least that's the API), which one 
> can then process using standard array operators (+, *, etc.), methods 
> (transpose, flipud, fliplr, etc), etc. and create and apply new colormaps by 
> simply saying "colormap = <new N x 3 array>" - are there tools which enable 
> this manner of manipulating MPL's colormap class instances?  Or
> a "built-in" API to these that I'm not finding?  Thanks!
> 
> DG
> 
> PS: In case this is relevant, I'm using the OO API, not pylab.  Thanks again.
> 
> 
> 
>       
> 
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to