[R] question on axis box with asp=1

Dan Kelley Dan.Kelley at dal.ca
Tue Oct 23 01:48:38 CEST 2007

I've been using (and loving) R for quite a while now, but I have to  
admit that something simple is still stumping me.

The question is how I can control the box within which a plot is  
drawn, in cases where I'm controlling the aspect ratio with the "asp"  

The problem comes up in pdf() and png() output formats, but also with  
interactive windows, and so I'll express myself in terms of the latter.

For example, if I write


and then resize the plot, the system will adjust the y axis range  
outside the 3-to-4 value.  I'd rather it just put whitespace above  
and below the plotting frame.

My next attempt is to try




and these agreeably let me control the range of numbers on the axis,  
but the frame still extends outside the desired region.  (At this  
point, I can explain why I care ... I'm drawing oceanographic data,  
and it makes no sense to have an axis frame that goes to the north of  
90N or the south of 90S.)

Is there a way that I can, perhaps, make the upper and lower margins  
be "stretchable", as one would say in the TeX world?  That would seem  
to be a clean solution to my problem.

Of course, the problem arises also when I output to a file.  I find  
myself doing trial after trial, to get the width and height just  
right to prevent R from using axes that I do not desire.

PS. I apologize for the length of this email; I'm just trying to be  
clear, and also to show that I have at least done a little research  
into the lovely R system.

Dan E. Kelley, Associate Professor                phone:(902)494-1694
Oceanography Department, Dalhousie University       fax:(902)494-3887
Halifax, Nova Scotia                         mailto:Dan.Kelley at Dal.CA
Canada B3H 4J1   http://oceanography.dal.ca/ocean_C699.html

More information about the R-help mailing list