comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: Re: setting the aspect ratio

Re: setting the aspect ratio
type: item
description: In article <1991Oct28.035605.19990@murdoch.acc.Virginia.EDU>, gl8f@fermi.clas.Virginia.EDU (Greg Lindahl) writes... > I have a contour plot where the X axis has 3 times the range of the Y > axis. I want the contour plot to indicate this by making the plot 3 > times wide as it is tall. > > Is there any *easy* way to do this? Most graphics packages let you > tell them if you want a 1:1 aspect ratio for the X and Y axes. But the > best I can find in IDL is to use device-specific stuff in the device > command or for X-windows, to resize the window by hand. I think the following procedure should do what you want. It sets the IDL scaling parameters so that subsequent plot calls (PLOT, CONTOUR, etc.) are scaled correctly. The actual corners of the plot are not changed, though, so that a contour plot would not go out to the axes. I would think this could be changed too, though, by changing !SC1, !SC2, ... (or more properly these days !P.POSITION). As an added refinement, I've recently added the system variable !ASPECT for graphics devices without square pixels. This system variable contains the ratio of the pixel height to pixel width, and is normally 1. It can be defined through the command DEFSYSV, '!ASPECT', 1.0 or could also easily be removed from the routine below. Bill Thompson PRO SETSCALE,P1,P2,P3,P4,NOBORDER=NOBORDER ;+ ; NAME: ; SETSCALE ; PURPOSE: ; Sets the plot scale such that it is the same in the X and Y directions. ; CATEGORY: ; CALLING SEQUENCE: ; SETSCALE - Resets to default. ; SETSCALE, ARRAY - Calculates scale for CONTOUR. ; SETSCALE, XARRAY, YARRAY - Calculates scale from arrays. ; SETSCALE, XMIN, XMAX, YMIN, YMAX - Calculates scale from limits. ; OPTIONAL INPUT PARAMETERS: ; ARRAY - Two dimensional array to be used in a simple ; contour plot. The minima are set to zero, ; and the maxima are set to one less than the ; dimensions of the array. ; XARRAY, YARRAY - Arrays from which the minimum and maximum ; values are calculated. ; XMIN, XMAX, YMIN, YMAX -…
creator: thompson
date: 1991-10-28T13:29:00-00:00