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

Home » Public Forums » archive » Re: color by variable interpolate?
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: color by variable interpolate? [message #50130 is a reply to message #50129] Tue, 12 September 2006 06:53 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Jon writes:

> I have been trying to wrap my mind around how to make this work, but
> have not figured it out and hoped that someone could give me a little
> help.
>
> I'm trying to color some data by temperature...
>
> x y t
> 5 8 -2.5
> 6 6 -1.3
> 2 4 -5.3
> 10 6 -3.5
>
> I'm using the rainbow color table and want the warmest value -1.3 to
> correspond to the color 255 (red) and the coldest value -5.3 to
> correspond to the color 12 (dark purple)

Humm. Your way is...odd. :-)

I think I would do it like this:

LoadCT, 33 ; Rainbow color table

; Scale temp from 12 to 255.
color = BytScl(T, Top=255-12) + 12B

; Sort temp from cold to hot
sortIndex = Sort(T)
x = x[sortIndex]
y = y[sortIndex]
T = T[sortIndex]
PLOT, x, y, /NoData
PLOTS, x, y, PSym=sym(3), Color=T


> I'm not even sure if this is the best way to do
> this (a for loop).

Probably not. :-)

It might be easier to just learn how to construct a color
table that goes from red to purple in as many steps as
you want. Here is an article that describes the process:

http://www.dfanning.com/color_tips/create_colortable.html

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Changing the Dec labeling from horizontal to vertical
Next Topic: Reading from the prompt

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

Current Time: Sat Oct 11 21:39:08 PDT 2025

Total time taken to generate the page: 1.68141 seconds