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

Home » Public Forums » archive » Re: modify colors in contour plots
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: modify colors in contour plots [message #79761] Tue, 03 April 2012 13:33
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Anil writes:

> Is there any other way of doing it without the cgcolorbar,
> cgplots ,cg***?? Can't i just use contour and still do it?

By the way, if you are unsure about how to do this
with traditional IDL commands, this book explains
it all in detail:

http://www.idlcoyote.com/books/index.php

I'm not trying to hide anything from you. ;-)

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.")
Re: modify colors in contour plots [message #79762 is a reply to message #79761] Tue, 03 April 2012 13:25 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
anil writes:

> Is there any other way of doing it without the cgcolorbar,
> cgplots ,cg***?? Can't i just use contour and still do it?

Sure, of course. That's what cgContour et al use. You
can roll your own. ;-)

> It was
> working fine with contour except the colors but with the code above,
> IDL gives:
> % CONTOUR: Warning: Infinite plot range.
> % CONTOUR: Warning: Infinite plot range.
> % CONTOUR: Warning: Infinite plot range.

Well, I don't know. When I run the program with the
latest Coyote Library I get this output:

http://www.idlcoyote.com/misc/nonlinear_contour.png

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.")
Re: modify colors in contour plots [message #79763 is a reply to message #79762] Tue, 03 April 2012 13:12 Go to previous message
Brian Wolven is currently offline  Brian Wolven
Messages: 94
Registered: May 2011
Member
That is exactly why there is a cg* version. =)
Re: modify colors in contour plots [message #79764 is a reply to message #79763] Tue, 03 April 2012 12:58 Go to previous message
anil is currently offline  anil
Messages: 34
Registered: August 2009
Member
On Apr 3, 1:10 am, David Fanning <n...@idlcoyote.com> wrote:
> anil writes:
>> I have a contour plot of temperature. My temperature range is 4-26
>> celsius. I want to have the colors in the contour plot, such that I
>> can use lots of colors for the ranges [4-8] and [8-15] . What i want
>> to do is to give many colors to the range i want ( 4-8 celsius for my
>> case) , a few colors for the range [8-15] and just a single color to
>> [15-26] . How can i do this color distribution?
>
> You could do it like this:
>
> data = cgdemodata(2)
> data = scale_vector(data, 4.0, 26.0)
> levels = scale_vector(findgen(14), 4, 8)
> levels = [levels, scale_vector(findgen(8), 8, 15)]
> levels = levels[Uniq(levels)]
> cgLoadCT, 27, NCOLORS=22, /Brewer
> cgContour, data, LEVELS=levels, /Fill, C_Colors=Indgen(22), $
>    Position=[0.1, 0.1, 0.9, 0.8]
> cgContour, data, LEVELS=levels, /Overplot
> cgColorbar, XTickV=[4, 11, 18, 25, 26], XTicks=4, $
>    NColors=22, RANGE=[4,26], $
>    TickNames=['4', '6', '8', '18', '26'], XMinor=0
> END
>
> 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.")

Is there any other way of doing it without the cgcolorbar,
cgplots ,cg***?? Can't i just use contour and still do it? It was
working fine with contour except the colors but with the code above,
IDL gives:
% CONTOUR: Warning: Infinite plot range.
% CONTOUR: Warning: Infinite plot range.
% CONTOUR: Warning: Infinite plot range.
Re: modify colors in contour plots [message #79775 is a reply to message #79764] Mon, 02 April 2012 15:10 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
anil writes:

> I have a contour plot of temperature. My temperature range is 4-26
> celsius. I want to have the colors in the contour plot, such that I
> can use lots of colors for the ranges [4-8] and [8-15] . What i want
> to do is to give many colors to the range i want ( 4-8 celsius for my
> case) , a few colors for the range [8-15] and just a single color to
> [15-26] . How can i do this color distribution?

You could do it like this:

data = cgdemodata(2)
data = scale_vector(data, 4.0, 26.0)
levels = scale_vector(findgen(14), 4, 8)
levels = [levels, scale_vector(findgen(8), 8, 15)]
levels = levels[Uniq(levels)]
cgLoadCT, 27, NCOLORS=22, /Brewer
cgContour, data, LEVELS=levels, /Fill, C_Colors=Indgen(22), $
Position=[0.1, 0.1, 0.9, 0.8]
cgContour, data, LEVELS=levels, /Overplot
cgColorbar, XTickV=[4, 11, 18, 25, 26], XTicks=4, $
NColors=22, RANGE=[4,26], $
TickNames=['4', '6', '8', '18', '26'], XMinor=0
END

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: Re: Coyote Graphics Raster File Output
Next Topic: Coyote Graphics 8-bit PNG Output

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

Current Time: Wed Oct 08 15:17:12 PDT 2025

Total time taken to generate the page: 0.00475 seconds