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?
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
*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
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
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 =
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,