colormap creation

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

c=['#6C9F7B','#783F68','#F4F4F2','#22F322','#F3F322','#0000F3']
mycm=mpl.colors.LinearSegmentedColormap.from_list('mycm',c)
plt.imshow(rand(10,10),cmap=mycm,interpolation='nearest')
colorbar()
plt.show()

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

P.Romero

···

-----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:

Jeff,
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.

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

black
blue
yellow
red
purple

... 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

colors...

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.

-Jeff

Thanks,
P.Romero

-----Original Message-----
From: Jeff Whitaker [mailto:jswhit@…146…]
Sent: 2009-08-14 5:29 PM
To: P.R.
Cc: matplotlib-users@lists.sourceforge.net
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

Im

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,
Thanks,
P.Romero
  
P.R.: If you haven't already, you should look at the custom_cmap.py
example.

-Jeff

--
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 : Jeffrey S. Whitaker: NOAA Physical Sciences Laboratory