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

Home » Public Forums » archive » CG Elevation image + arbitrary discrete colorbar
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
CG Elevation image + arbitrary discrete colorbar [message #79795] Fri, 30 March 2012 01:48
Matteo is currently offline  Matteo
Messages: 28
Registered: August 2011
Junior Member
Hallo,
I've checked many of David's links and I seem to find all pieces for a
little problem I'm trying to solve...still I can't manage to glue them
together properly.
I'm trying to scale an image between arbitrary min and max values,
with an arbitrary number of levels, and getting the proper (discrete)
colorbar associated with it. I'm trying to use the new OOB_* options
to leave values < min in one color and values > max of another.

In the example below, I'd for example to have 10 levels between 0 and
3000m, and elevations <0 set to black and elevations > 2000 set to
white.

I'm also trying to get the same result using bytscl and scale_vector.

Does anybody have any suggestions?

Many thanks,
Matteo


pro cbar
compile_opt idl2

nclrs=10
minelev=0.
maxelev=2000.
p = [0.02, 0.15, 0.98, 0.98]

cgLoadCT, 33, NColors=nclrs, Bottom=1
TVLCT, cgcolor('white',/Triple), nclrs+1

image=cgDemoData(7)
;scaledImage = Scale_Vector(image, 0, nclrs, MINVALUE=minelev,
MAXVALUE=maxelev, /nan)
scaledImage = bytscl(image, MIN=minelev, MAX=maxelev, top=nclrs+1, /
nan)

cgWindow, WXSize=700, WYSize=700
cgImage, scaledimage, position = p, MinValue=0, MaxValue=nclrs,
Top=nclrs-1, /Keep, /Add
cgColorbar, Position=[p[0], p[1]-0.1, p[2], p[1]-0.05], NColors=nclrs,
$
Range=[minelev,maxelev], Divisions=10, bottom=1, $
/discrete, OOB_Low='black', OOB_High='white', /Add

end
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: plot colored ellipses
Next Topic: Retina!

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

Current Time: Wed Oct 08 11:44:50 PDT 2025

Total time taken to generate the page: 0.00484 seconds