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 
Return to the default flat view Create a new topic Submit Reply
Re: modify colors in contour plots [message #79764 is a reply to message #79763] Tue, 03 April 2012 12:58 Go to previous messageGo 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.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
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: Fri Oct 10 17:28:15 PDT 2025

Total time taken to generate the page: 0.55848 seconds