[Matplotlib-users] how to define custom colormap from set of RGB values ?

2010-06-16 Thread Jim Vickroy
Hello, The attached script shows my (failed) attempt to define a custom color map from a set of RGB values (taken from an IDL palette). My approach is presumably completely wrong, but I have not found information or examples on how to do this. Could someone point in the right direction?

Re: [Matplotlib-users] how to define custom colormap from set of RGB values ?

2010-06-16 Thread PHobson
Give this a shot: http://www.scipy.org/Cookbook/Matplotlib/Show_colormaps From: Jim Vickroy [mailto:jim.vick...@noaa.gov] Sent: Wednesday, June 16, 2010 8:14 AM To: Matplotlib Subject: [Matplotlib-users] how to define custom colormap from set of RGB values ? Hello, The attached script shows my

Re: [Matplotlib-users] how to define custom colormap from set of RGB values ?

2010-06-16 Thread Jim Vickroy
*To:* Matplotlib *Subject:* [Matplotlib-users] how to define custom colormap from set of RGB values ? Hello, The attached script shows my (failed) attempt to define a custom color map from a set of RGB values (taken from an IDL palette). My approach is presumably completely wrong, but I have

Re: [Matplotlib-users] how to define custom colormap from set of RGB values ?

2010-06-16 Thread PHobson
To: Paul Hobson Cc: matplotlib-users@lists.sourceforge.net Subject: Re: [Matplotlib-users] how to define custom colormap from set of RGB values ? phob...@geosyntec.commailto:phob...@geosyntec.com wrote: Give this a shot: http://www.scipy.org/Cookbook/Matplotlib/Show_colormaps Thanks for your

Re: [Matplotlib-users] how to define custom colormap from set of RGB values ?

2010-06-16 Thread Jae-Joon Lee
As you can see from the error, the dimension of your input is wrong (it needs to be transposed). Furthermore, matplotlib expects the rgb values in 0-1. replace colormap = matplotlib.colors.ListedColormap(palette,'custom-orange') with colormap =

Re: [Matplotlib-users] how to define custom colormap from set of RGB values ?

2010-06-16 Thread Jae-Joon Lee
Did you check values in palette? With palette /= 255 you're setting the value in place. Because the palette.dtype is int, the result is also an integer array, i.e., only with with zeros and ones. You may do palette = [reds,greens,blues] palette = numpy.array(palette, dtype=d) Regards,