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

Home » Public Forums » archive » cgScaleVector and diverging colorbar help
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: cgScaleVector and diverging colorbar help [message #91286 is a reply to message #91285] Thu, 25 June 2015 09:19 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

>
> sam.tushaus@gmail.com writes:
>
>> Hello all! I'm trying to create a plot with a diverging colorbar. I would like white to correspond to 0, and my data is typically in the range [-5,70] on a latitude-longitude grid.
>>
>> I've been using this page (http://www.idlcoyote.com/code_tips/scaleimage.html) as a reference. The first problem comes when I try to use cgImage to display my scaled data - the map becomes highly distorted. Is there any way to fix this?
>>
>> My second problem comes when I try to use cgContour to display my scaled data instead of cgImage. The contouring looks generally correct, but the whole range of the colorbar is used in the contouring. This is a problem because my data range is [-5,70] and I want 0 to be white.
>>
>> I really appreciate any comments or hints on how to fix this
>
> data = cgScaleVector(cgDemoData(7), -5, 70)
> Loadct, 0 ; Reset colors
> cgLoadct, 1, NColors=10, Clip=[100,250]
> cgLoadCt, 3, NColors=140, Bottom=11, /Reverse
> TVLCT, cgColor('white', /Triple), 10
> cgImage, BytScl(data, Top=151), Position=[0.125, 0.1, 0.925, 0.75]
> cgColorbar, NColors=151
> cIndex
> END

Whoops! The cgColorbar command should have a range on it:

cgColorbar, NColors=151, Range=[-5, 70]

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
Read Message
Previous Topic: FG image change
Next Topic: Storing values in array after each iteration in for loop

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

Current Time: Wed Oct 08 14:00:09 PDT 2025

Total time taken to generate the page: 0.00467 seconds