Hi all,

I'd like to create a ListedColormap with different alpha values, like

...
        [ 1.  ,  1.  ,  1.  ,  0.65],
        [ 1.  ,  1.  ,  1.  ,  0.66],
        [ 1.  ,  1.  ,  1.  ,  0.67],
        [ 1.  ,  1.  ,  1.  ,  0.68],
        [ 1.  ,  1.  ,  1.  ,  0.69],
        [ 1.  ,  1.  ,  1.  ,  0.7 ],
        [ 1.  ,  1.  ,  1.  ,  0.71],
        [ 1.  ,  1.  ,  1.  ,  0.72],
        [ 1.  ,  1.  ,  1.  ,  0.73],
        [ 1.  ,  1.  ,  1.  ,  0.74],
        [ 1.  ,  1.  ,  1.  ,  0.75],
        [ 1.  ,  1.  ,  1.  ,  0.76],
        [ 1.  ,  1.  ,  1.  ,  0.77],
        [ 1.  ,  1.  ,  1.  ,  0.78],
        [ 1.  ,  1.  ,  1.  ,  0.79],
...


meaning "map all my values to white, but with different alpha".

When I do something like this:

myColormap = matplotlib.colors.ListedColormap(my_rgba_array)
contourf(x,y,data,arange(0.1,1.05,0.05), cmap=myColormap)

it seems like my alpha values get changed to "1" deep inside 
matplotlib.colors.Colormap/LinearSegmentedColormap/ListedColormap.

After looking at the source of matplotlib.colors, it seems to me that 
different alpha values are something Colormap is not designed for.

Something like:
myColormap._lut = my_rgba_array
doesn't work.

What would be the best approach to create a Colormap with different 
alphas? ListedColormap would be convinient, but I can also go with 
LinearSegmentedColormap.


Regards
Simon

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to