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

Home » Public Forums » archive » Re: Q: square plots in IDL
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: Q: square plots in IDL [message #3249 is a reply to message #3246] Mon, 28 November 1994 06:46 Go to previous message
bowman is currently offline  bowman
Messages: 121
Registered: September 1991
Senior Member
In article <3bc67s$6em@info.estec.esa.nl>, gvacanti@estsa2.estec.esa.nl
(Giuseppe Vacanti) 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,

This works for me:

PRO SET_ASPECT, aspect, MARGIN = margin

; This program sets the plot position, !P.POSITION
; to ensure the desired aspect ratio for the final
; plot with a margin on each side.

;Find the aspect ratio of the current window
daspect = FLOAT(!D.Y_SIZE)/FLOAT(!D.X_SIZE)
IF NOT KEYWORD_SET(margin) THEN margin = 0.05

IF(aspect LE daspect) THEN BEGIN
x0 = margin
y0 = 0.50 - (0.5 - margin)*(aspect/daspect)
x1 = 1.0 - margin
y1 = 0.50 + (0.5 - margin)*(aspect/daspect)
ENDIF ELSE BEGIN
x0 = 0.50 - (0.5 - margin)*(daspect/aspect)
y0 = margin
x1 = 0.50 + (0.5 - margin)*(daspect/aspect)
y1 = 1.0 - margin
ENDELSE
!P.POSITION = [x0, y0, x1, y1]

RETURN
END


Call it with aspect = 1.0. You can vary the margin as you wish.

Ken Bowman

P.S. As always, bug reports welcome.

--
Dr. Kenneth P. Bowman 409-862-4060
Associate Professor 409-862-4132 fax
Climate System Research Program bowman@csrp.tamu.edu
Department of Meteorology PP-Glider
Texas A&M University
College Station, TX 77843-3150
[Message index]
 
Read Message
Read Message
Previous Topic: thanks
Next Topic: Call_external under Solaris

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

Current Time: Sun Oct 12 02:37:31 PDT 2025

Total time taken to generate the page: 1.12089 seconds