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 #85606 is a reply to message #85604] Wed, 21 August 2013 06:03 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
ljs15@fsmail.net writes:

> I am plotting data that range from negative to positive, so am using a blue-white-red colour bar. However, I would like there to be more white in the middle of the bar.
>
> At the moment I'm using the following clumsy commands to achieve this:
>
> maxv = 10
> cgloadct, 13, /brewer, /reverse, ncolors=9, bottom=0, /silent, clip=[0,225]
> cgloadct, 16, /brewer, ncolors=9, bottom=12, /silent, clip=[0,225]
> clev = scale_vector(findgen(21), -maxv, maxv)
> ccol = bindgen(21)
> ;Make middle levels white
> ccol[9:11] = cgcolor('white')
>
> and then:
>
> cgColorbar, ncolors=20, range=[-maxv, maxv]
>
> While this gives me the plot shading I want, the colour bar is incorrect. As I have manually altered the middle values to white, they don't show in the colour bar, which only uses the 18 colours defined by cgloadct.
>
> Is there a simple way around this?

I think the simplest way around it is this:

cgLoadCT, 22, /Brewer, /Reverse, NColors=20
cgColorBar, NColors=20, range=[-10,10]

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.")
[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 05:45:01 PDT 2025

Total time taken to generate the page: 1.84716 seconds