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

Home » Public Forums » archive » Re: Stupid color question
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
Re: Stupid color question [message #38880] Wed, 07 April 2004 09:19
mmiller3 is currently offline  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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: library and online help
Next Topic: Re: IDL crashes/hangs while reading images

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

Current Time: Fri Oct 10 07:03:12 PDT 2025

Total time taken to generate the page: 5.68269 seconds