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

Home » Public Forums » archive » Adding extra white in middle of colour bar
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: Adding extra white in middle of colour bar [message #85613 is a reply to message #85608] Wed, 21 August 2013 12:52 Go to previous messageGo to previous message
Sir Loin Steak is currently offline  Sir Loin Steak
Messages: 42
Registered: January 2012
Member
On Wednesday, 21 August 2013 15:04:46 UTC+1, David Fanning wrote:
> ljs15@fsmail.net writes:
>
>
>
>> That's the method I originally used, but that means the white colour is only being given to the middle contour range.
>
>>
>
>> What I want (for example) is eight contours -10,-9,...,-2 to be shades of blue, and eight contours 2,3,...,10 to be shades of red, and the contours between -2 and +2 to be white.
>
>>
>
>> Not sure if this is possible without having to manually make a colour table and load it with tvlct.
>
>
>
> If the right color table doesn't exist, you have to create it. No
>
> question about that. :-)
>
>
>
> cgLoadCT, 22, /Brewer, /Reverse, NColors=21
>
> TVLCT, cgColor(Replicate('white',3), /Triple), 9
>
> cgColorbar, NColors=21, Range=[-10,10], XTicks=2, XMinor=0
>
>
>
> Cheers,
>
>
>
> David
>
>
>
>
>
>
>
> --
>
> David Fanning, Ph.D.
>
> Fanning Software Consulting, Inc.
>
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
>
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")


Thanks David, that's very helpful.

But this does bring me on to something else I've been wondering about regarding contours and fill colours (sorry for all the questions!).

Say I had data and wanted to contour it from -10 to +10 using a blue-white-red colour scale. I would normally do:

ncont = 21
cgloadct, 22, /brewer, /reverse, ncolors=ncont, /silent
clev = scale_vector(findgen(ncont), -maxval, maxval)
ccol = bindgen(ncont)

Then contour it using levels=clev, c_colors=ccol.

However, I actually want [-10,-9] to be one colour, [-9,-8] to be another colour etc. So I actually need 20 fill colours not 21.

If I select ncont=20 then my levels do not come out as integer values, but using ncont=21 means the colour bar is not divided neatly in two, with red colours > 0 and blue colours < 0.

Am I misunderstanding how IDL fills in the contours? Is there a way around this problem? I assume that if I set the levels to [-1,0,1] and tell IDL to fill the contour plot, then it fills [-1,0],[0,1],[1,1+].

Thanks again for the help.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: spawn not working
Next Topic: Navigating AVIRIS Images

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

Current Time: Fri Oct 10 19:39:39 PDT 2025

Total time taken to generate the page: 7.20171 seconds