Re: How to make color-scale legend [message #852] |
Mon, 12 April 1993 15:35  |
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  |
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  |
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 |
|
|
|