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

Home » Public Forums » archive » Re: How to make color-scale legend
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: How to make color-scale legend [message #852] Mon, 12 April 1993 15:35 Go to next message
ian is currently offline  ian
Messages: 26
Registered: February 1992
Junior Member
In article <34196@oasys.dt.navy.mil> ruckman@oasys.dt.navy.mil writes:
> Hello world,
>
> Is there a way to make a color-scale legend for a 3-D plot or image? By
> that I mean some sort of a color-coded strip or box showing the numeric
> values that correspond to various colors in the current color table.
>

Well, when I need such a box, I just make an array and fill each line with
a value from 0 to 255. The lines are in increasing or decreasing order. Then
I display it in an appropriate spot in the window, and read the screen into
a variable to make the combined image.

There may be a better way to do it, but this works for me.

|-Ian Novack (Particle Man)----------------------------ian@gomez.jpl.nasa.gov-|
| "I am trying to fill a silent moment with Jet Propulsion Lab |
| non-relevant conversation." -- Lt. Cmdr. Data Pasadena, CA |
|-Disclaimer: Had this been an actual opinion, it would still be mine.--------|
Re: How to make color-scale legend [message #999 is a reply to message #852] Tue, 13 April 1993 06:46 Go to previous message
thompson is currently offline  thompson
Messages: 584
Registered: August 1991
Senior Member
ruckman@oasys.dt.navy.mil writes:

(Stuff deleted)

> I had to make a minor modification that I suspect is needed often by users of
> IDL for Windows. The procedures use different techniques depending on the
> current device, but they were written before the 'WIN' device existed.
> Therefore, whenever I found a command such as

> if !d.name eq 'X' then begin

> I had to change it to

> if !d.name eq 'X' or !d.name eq 'WIN' then begin

Even better would be to just ask if the device has windows, e.g.

if have_windows() then begin

The following routines will test if a device supports windows and widgets
(which I understand that IDL for Windows now supports).

FUNCTION HAVE_WINDOWS
RETURN,(!D.FLAGS AND 256) NE 0
END

FUNCTION HAVE_WIDGETS
RETURN,(!D.FLAGS AND 65536) NE 0
END

One could simply put the references to !D.FLAGS directly into the calling
routine, but I feel that putting them into separate routines like this makes
for more understandable code.

This way you don't have to keep adding device names to your routines, e.g.
"or !d.name eq 'SUN'" in your example above.

Bill Thompson
Re: How to make color-scale legend [message #1000 is a reply to message #852] Tue, 13 April 1993 03:15 Go to previous message
ruckman is currently offline  ruckman
Messages: 3
Registered: February 1993
Junior Member
In article <1qcqrbINNm7f@elroy.jpl.nasa.gov> ian@gomez.Jpl.Nasa.Gov (H. Ian Novack) writes:
> In article <34196@oasys.dt.navy.mil> ruckman@oasys.dt.navy.mil writes:
>> Is there a way to make a color-scale legend for a 3-D plot or image? By
> ....
> Well, when I need such a box, I just make an array and fill each line with
> a value from 0 to 255. The lines are in increasing or decreasing order. Then
> I display it in an appropriate spot in the window, and read the screen into
> a variable to make the combined image.

I found a solution in a group of procedures available by anonymous ftp. There is
a procedure called TVIM that displays an image with axes, a title, and a color
scale.

I had to make a minor modification that I suspect is needed often by users of
IDL for Windows. The procedures use different techniques depending on the current
device, but they were written before the 'WIN' device existed. Therefore, whenever
I found a command such as

if !d.name eq 'X' then begin

I had to change it to

if !d.name eq 'X' or !d.name eq 'WIN' then begin

I also modified the color scale legend to show the exponent separately when
the numbers are very small or large. In other words, rather than showing the
values as x.xxe-yy, I show them as x.xx and then put the exponent at the bottom.
Anyone interested in the modifications should e-mail me.

--
Chris Ruckman - ruckman@oasys.dt.navy.mil | This .sig brought to you by
Hull Structures Acoustics, Code 741 | your local Chevrolet bottler.
Carderock Division, NSWC |
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Making help for your own functions & procedures
Next Topic: How to make 2-d plots in 3-d?

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

Current Time: Wed Oct 08 16:01:35 PDT 2025

Total time taken to generate the page: 0.00870 seconds