Re: Q: square plots in IDL [message #3246] |
Mon, 28 November 1994 09:57  |
sjt
Messages: 72 Registered: November 1993
|
Member |
|
|
Giuseppe Vacanti (gvacanti@estsa2.estec.esa.nl) wrote:
: Hello-
: I would like to plot data so that the aspect ratio of the plot is
: equal to 1 (a circle would actually be a circle on paper, and not
: an ellipse, as it is in my IDL documentation). I have played with
: various key-words but I don't seem able to get it right.
: Any input is welcome.
: Thanks,
An initial point:
Unless you have made a square page with the WINDOW procedure or a
DEVICE call (depending on your device) avoid using procedures which set
up data coordinates implicitly (e.g. PLOT, SURFACE etc.).
Instead you will need to create your own plot transform.
1) Determine size of device each way in cm
xcm = !d.x_size/float(!d.x_px_cm)
ycm = !d.y_size/float(!d.y_px_cm)
2) Determine your scaling factor (user unit/cm)(assume xr, yr are the ranges
of x and y that you need).
xscl = xr/xcm
yscl = yr/ycm
scl = xscl > yscl
3) Define your plot transform (assume xm, ym are the minimum x and y you
want to plot)
!x.s = [-xm, 1.]/(scl*xcm)
!y.s = [-ym, 1.]/(scl*ycm)
This seemed to work when I tested it to plot a unit circle in an 800x437
pixel window using PLOTS
: --
: Giuseppe Vacanti
: Astrophysics Division / SERCO
: ESTEC - European Space Agency
: P.O. Box 299 Internet: Giuseppe.Vacanti@astro.estec.esa.nl
: 2200 AG, Noordwijk Phone : +31-71-654175
: The Netherlands FAX : +31-71-654690
--
+------------------------+---------------------------------- --+---------+
| James Tappin, | School of Physics & Space Research | O__ |
| sjt@star.sr.bham.ac.uk | University of Birmingham | -- \/` |
| "If all else fails--read the instructions!" | |
+----------------------------------------------------------- --+---------+
|
|
|