Re: Stupid color question [message #38880] |
Wed, 07 April 2004 09:19 |
mmiller3
Messages: 81 Registered: January 2002
|
Member |
|
|
>>>> > "Bruce" == Bruce Bowler <bbowler@bigelow.org> writes:
> It's time for another stupid color question... I have an
> 2d array of data that I want to display. Currently I do it
> with the following...
> tv, bytscl(glocal, min = 0, max = maxval)
> There are 2 allowable negative values, that are, as a
> result of the bytscl set to "0" in the display. What I'd
> like to do is have those 2 negative values displayed with
> the 2 lowest colors in the color table and then scale the
> values from 0 to maxval across the remaining colors. I'm
> sure I could write my own bytscl-like routine to do that,
> but if it's already been done or is available in 5.6
> already...
Suppose you wanted the two negative values to show up as blue and
red. Then you could do the following
loact, 0 ; load color table here
red = 255
tvlct, 200, 0, 0, red
blue = 254
tvlct, 72, 61, 180, blue
topClr = 253
img = bytscl(glocal, min = 0, max = maxval, top=topClr)
img[where(glocal eq one_negative_value)] = red
img[where(glocal eq other_negative_value)] = blue
tv, img
If you just want the bottom two colors in the color table, use
this instead:
img[where(glocal eq one_negative_value)] = 0
img[where(glocal eq other_negative_value)] = 1
tv, img
Mole
|
|
|