[R] plots: screwed up aspect ratio

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Mon Sep 11 11:59:45 CEST 2000

Bill Simpson <wsi at gcal.ac.uk> writes:

> This is a new problem: Old versions of R worked fine. I am not sure when
> it got broken. I am posting here instead of bugs in case this is not a
> true bug.
> New vanilla plots (I mean I don't fool around with par() etc) are screwed
> up in several ways:
> - the tick marks are twice as long as they should be
> - the gap between the end of the tick and the top of the numerical labels
> is twice as big as it should be
> - the gap between the bottom of the numerical labels and the axis label is
> twice as big as it should be
> - the aspect ratio is screwed up
> [Note in above where I say "should be" I also mean "used to be"]
> I am just going to concentrate on the last. If I do
> dev.print(pointsize=21,horizontal=FALSE,width=4.5,height=4.5,
> file="papers/spatiotemp/plot1a.jm.ps")
> I expect that a square plot will be printed to the file. This method has
> worked for the past 5 yrs or so. But the latest version of R makes a plot
> that is about half as high as it is wide.

[I'd be surprised if any of this worked in 1995...] 

The main culprit is the pointsize=21 making the text line unit around
the plot about twice as big as the actual text (which will have the
size specified when plotting to the screen). Did you by any chance
mean "12" there?

The mismatch between the screen and the print if pointsize gets
diddled is a bit annoying, but hardly new. The graphics replay code
should probably rescale all text by the ratio of input to output

The "non-aspectness" is a feature. If you look carefully, you'll see
that the bounding box of your plot really is square. However, there
are fewer lines of vertical text (6.2) than horisontal (9.2). To get a
square plotting region make sure that there is the same number of
lines in both directions, or calculate the width and height from the
character size. The latter is a bit painful, but not being able to
control the total width and height of a plot was considered more so. 

   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list