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

Home » Public Forums » archive » Re: How does IDL calculate the graph axis values?
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 does IDL calculate the graph axis values? [message #18702] Wed, 02 February 2000 00:00
mallors is currently offline  mallors
Messages: 76
Registered: November 1997
Member
In article <38986E90.5B2D58C8@ssec.wisc.edu>,
"Liam E. Gumley" <Liam.Gumley@ssec.wisc.edu> writes:
> Declan Vogt wrote:
>
>> I'd like to find out what IDL will use as the max and min values for a
>> graph axis before it actually plots the axis. I've been doing this by
>> creating a window, drawing the axis, and reading !x.crange, then erasing
>> the window, but it's not very elegant, and it doesn't work for
>> postscript.
>>
>> Does anyone know if there is an IDL routine I can call?
>
> I don't think there's a built-in routine for this purpose. However you can
> always use the Z buffer as a temporary graphics device:
>
> Say your data is defined as follows:
>
> x = findgen(200) * 0.1
> y = sin(x)
>
> First you save the current graphics setup:
>
> entry_device = !d.name
> entry_window = !d.window
> entry_config = {x:!x, y:!y, z:!z, map:!map}
>
> Then you create a temporary plot in the Z buffer:
>
> set_plot, 'Z'
> device, z_buffer=0
> plot, x, y, /nodata, xstyle=4, ystyle=4, /noerase, /ynozero
> xrange = !x.crange
> yrange = !y.crange

There is also the 'NULL' device to suppress
graphics output entirely:


dSave = !D.NAME
SET_PLOT, 'NULL'
.
.
.
SET_PLOT, dSave

Regards,

-bob mallozzi




--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~
Robert S. Mallozzi 256-544-0887
Mail Code SD 50
http://gammaray.msfc.nasa.gov/ Marshall Space Flight Center
http://cspar.uah.edu/~mallozzir/ Huntsville, AL 35812
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~
Re: How does IDL calculate the graph axis values? [message #18708 is a reply to message #18702] Wed, 02 February 2000 00:00 Go to previous message
Ben Tupper is currently offline  Ben Tupper
Messages: 186
Registered: August 1999
Senior Member
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
"Liam E. Gumley" wrote:
<blockquote TYPE=CITE>&nbsp;
<br>This method does not require a graphics window to be open, does not
care
<br>what graphics device is active, does not disturb the contents of the
Z
<br>buffer, and does not disturb the current plot settings.
<br>&nbsp;
<br><a href="http://cimss.ssec.wisc.edu/~gumley"></a>&nbsp;</blockquote>
Hello,
<p>I wonder if the IDLgrAxis object might be handy here.&nbsp;&nbsp; I
haven't thought about it before, but I would guess that
<br>the axis range in Direct and Object graphics are determined in the
same way by IDL (or at least the results will be similar.)
<br>Assuming that your want to use direct graphics, you could temporarily
create an axis specifying your data range.&nbsp; Then use the GetProperty
method to retrieve
<br>CRange.&nbsp; Finally, destroy the object.
<p>Direction = 0&nbsp; ; or 1 for the yaxis
<br>oAxis = Obj_New('IDLgrAxis', Direction, Range = [YourDataMin,YourDataMax])
<br>oAxis -> GetProperty, CRange = CRange
<br>Obj_Destroy, oAxis
<p>Here's what the help file on CRange states:
<p>CRANGE
<br>Set this keyword to a named variable that will contain the actual full
range of the axis as a vector of the form [minval, maxval]. This range
may not exactly match the requested range provided via the RANGE keyword
in the Init and SetProperty methods. Adjustments may have been made to
round to the nearest even tick interval or to accommodate the EXTEND keyword.
<p>Ben
<pre>--&nbsp;
Ben Tupper

Bigelow Laboratory for Ocean Science
tupper@seadas.bigelow.org

pemaquidriver@tidewater.net</pre>
&nbsp;</html>
Re: How does IDL calculate the graph axis values? [message #18709 is a reply to message #18702] Wed, 02 February 2000 00:00 Go to previous message
Liam E. Gumley is currently offline  Liam E. Gumley
Messages: 378
Registered: January 2000
Senior Member
Declan Vogt wrote:

> I'd like to find out what IDL will use as the max and min values for a
> graph axis before it actually plots the axis. I've been doing this by
> creating a window, drawing the axis, and reading !x.crange, then erasing
> the window, but it's not very elegant, and it doesn't work for
> postscript.
>
> Does anyone know if there is an IDL routine I can call?

I don't think there's a built-in routine for this purpose. However you can
always use the Z buffer as a temporary graphics device:

Say your data is defined as follows:

x = findgen(200) * 0.1
y = sin(x)

First you save the current graphics setup:

entry_device = !d.name
entry_window = !d.window
entry_config = {x:!x, y:!y, z:!z, map:!map}

Then you create a temporary plot in the Z buffer:

set_plot, 'Z'
device, z_buffer=0
plot, x, y, /nodata, xstyle=4, ystyle=4, /noerase, /ynozero
xrange = !x.crange
yrange = !y.crange

Then you restore the entry graphics setup:

set_plot, entry_device
if (entry_window ge 0) then wset, entry_window
!x = entry_config.x
!y = entry_config.y
!z = entry_config.z
!map = entry_config.map

The x and y axis ranges computed by IDL are then returned:

print, xrange, yrange
0.00000 20.0000
-1.00000 1.00000

This method does not require a graphics window to be open, does not care
what graphics device is active, does not disturb the contents of the Z
buffer, and does not disturb the current plot settings.

Cheers,
Liam.
http://cimss.ssec.wisc.edu/~gumley
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: data interpolation
Next Topic: mapping data & grid (MAP_SET MAP_GRID)

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

Current Time: Wed Oct 08 11:37:12 PDT 2025

Total time taken to generate the page: 0.00642 seconds