Re: COLOR BAR [message #2538] |
Wed, 27 July 1994 05:43  |
landers
Messages: 45 Registered: May 1993
|
Member |
|
|
Victor Shvetsky writes:
|>
|> I was wondering if anyone has a routine for widgets that would plot a nice
|> color bar AND put some value on it. I can create a color bar, but I am not
|> able to put text on it NICELY, unless I use XYOUTS.
|> any suggestions would be greatly appreciated.
|>
You can use AXIS, something like this:
; first set up a plot space - make a null plot with no axes
; you could add a Position keyword to put it somewhere special
; Use /NoErase if you're adding the color bar to an existing plot
PLOT,[0,1],/NoData,XStyle=4,YStyle=4
; get the corners of the plot space (in device units)
px = !X.Window * !D.X_VSize
py = !Y.Window * !D.Y_VSize
; get the widths of the plot space
swx = px(1) - px(0)
swy = py(1) - py(0)
; Draw the color bar (colors run from index 0 at left to !D.N_Colors-1
; at right)
TVSCL, FINDGEN(swx) # REPLICATE(1.,swy), px(0),py(0), /Device
; Now add an axis. You can use any of the XRange, XStyle, XTicks, etc.
; keywords to make the axes what you like.
; I usually like to make XTicklen a small negative number so the axis ticks
; hang below the axis, rather than getting lost in the color bar
AXIS, XAxis=0., XRange=[0,10], XTicklen=-0.02
^^^^^^
Your range goes here.....
Luck
;Dave
|
|
|