colormap creation

Ok, so this is what I was trying to achieve...


That was the initial goal; being able to quickly create the cmap based on
some basic colors.
from there, I can optionally play with the mycm._segmentdata dictionary in
order to fine-tune the color spread.

...the documentation on the 'LinearSegmentedColormap.from_list()' method is
very brief,
and there wasn't an example, so I didn't see it right away...

Anyway, problem solved.
Sorry for the confusion, & thanks again for the help



-----Original Message-----
From: Jeff Whitaker [mailto:jswhit@…146…]
Sent: 2009-08-14 6:35 PM
To: P.R.
Subject: Re: [Matplotlib-users] colormap creation

P.R. wrote:

Thanks for pointing me to that example.
I was basically manually performing the same operations as those listed in
the example.
however, like I said before, its been slow going, since I have to manually
edit the ranges & adjust 'linear spread' of each color.
It's a trial & error process...

Im clear on how the rgb dictionary works;
I guess my problem/question was more on how to automate some of the work
involved in creating the rgb dictionary.

Supposing that I have a rough idea of what color sequence I want,
let's say,


... yet Im not sure about the exact values or 'tones' of these colors...
(this is an arbitrary example, let's assume that a similar cmap doesn't
already exist in mpl)

- I'd like to have an automatic method to easily create a preliminary,
'rough draft' rgb dictionary based on the rgb values for my basic


this way, I can quickly create a 'prototype' dictionary that I can then
modify & adjust to suit my needs.

so, a 'colormap generator' that takes a set of rgb values as input, and
create the value ranges within the rgb dictionary automatically...

Any ideas?
Nope, sorry.



-----Original Message-----
From: Jeff Whitaker [mailto:jswhit@…146…]
Sent: 2009-08-14 5:29 PM
To: P.R.
Subject: Re: [Matplotlib-users] colormap creation

P.R. wrote:

Can someone please recommend a (semi) automatic way to create the rgb
dictionaries needed for colormap creation?
Basically, I have a 'general' idea of how I want my colors ordered, but


finding it difficult to create the smooth transitions by manually editing
the rgb dictionary for my custom colormap...the trial & error process is
tedious & not very accurate...

How were the matplotlib colormaps created?
Were they created manually or programmatically?
Was it done using a random color selection?

Please help,
P.R.: If you haven't already, you should look at the


Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jeffrey.S.Whitaker@...259...
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web :