comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: multiple contour plots with common color range
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: multiple contour plots with common color range [message #81131] Tue, 14 August 2012 21:36
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
sasha.mozgova@gmail.com writes:

> I have quite restrained experience with use of Contour Plots, so the following represents a problem for me.
>
> I need to make 5 different contour plots with the common range of colors. My understanding is that IDL takes the minimum and the maximum of the input arrays and assigns to them the first and the last colors, distributing the other colors in between. Now, I have 5 arrays, with different minimums and maximums o each one, and I would like to produce contour plots that would be directly comparable with eye, i.e. I would like them to have a common color range.

Well, you don't want IDL dictating how it is going
to do things to you. You want to take change of this! ;-)

Assuming that the colors actually mean something (not
clear if this is the case from your explanation), I would
find the minimum and the maximum of the five data sets all
together. Then I would decide how to partition that space
into some reasonable number of divisions. Suppose that the
minimum is 1427 and the maximum is 1585. Then, I might decide
to contour each data set from 1400 to 1600 in 10 steps of
20 units each. These will be your contour levels:

nlevels = 10
step = 20
levels = Indgen(nlevels)*step+1400

Next, I would load 10 contour colors:

cgLoadCT, 33, NColors=nlevels, Bottom=1

Then, I would do my five contour plots, using these levels
and colors:

cgContour, data1, Levels=levels, C_Colors=Indgen(nlevels)+1, ...
cgContour, data2, Levels=levels, C_Colors=Indgen(nlevels)+1, ...
cgContour, data3, Levels=levels, C_Colors=Indgen(nlevels)+1, ...
cgContour, data4, Levels=levels, C_Colors=Indgen(nlevels)+1, ...
cgContour, data5, Levels=levels, C_Colors=Indgen(nlevels)+1, ...

And I would finish it with a color bar.

cgColorbar, NColors=10, Bottom=1, Divisions=10, /Discrete, $
TickNames = StrTrim([levels, levels[ncolors-1]+step],2), ...

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: multiple contour plots with common color range
Next Topic: cgHistoplot over plot

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 18:57:14 PDT 2025

Total time taken to generate the page: 0.00446 seconds