[R] R-Graphics: Scaling axis

Thomas W Blackwell tblackw at umich.edu
Wed Mar 12 04:39:53 CET 2003

On Wed, 12 Mar 2003, Till Baumgaertel wrote:

> how can I scale the x- and y-axis of a "plot" to the same scale?
> My problem: The following command sequence produces the plot in a square.
> What I want is the x-axis to be 5 times as wide (measured e.g. in pixels)
> as the y-axis is long (because y ranges from -1 to 1 and x ranges from 0
> to 10).

It depends what graphics device you are using.  If the plot is in
a window on the computer screen, then resizing the window reshapes
the plot to whatever aspect ratio you want, interactively, so the
aspect ratio is not an issue.  For a hardcopy device, such as
postscript(), the traditional way to control the aspect ratio is
to fill up the rest of the page with margins.  For a nice, long
narrow plot ...

postscript("some.file.name", pointsize=11, horizontal=T)
par(mar=c(9.5,3.5,3,2), las=1)
plot(x, y, type="p")

	... but after printing one test page, I always take a ruler
and measure the spacing of the tick marks and calculate how to
adjust the margin widths better.  Seriously.  I use a ruler.
It's clunky, but if you care about the graphical scales, that's
how you do it, and no complaints.  Even the difference between "A4"
and "letter" paper sizes would throw off any automated calculation.

-  tom blackwell  -  u michigan medical school  -  ann arbor  -

More information about the R-help mailing list