[R] question on axis box with asp=1

Uwe Ligges ligges at statistik.uni-dortmund.de
Tue Oct 23 13:36:28 CEST 2007


Why don't you create a device that is approximately squared if you ask 
to have asp=1? I do not understand why you resize anything. It simply 
does not make sense in that case.

Uwe Ligges




Dan Kelley wrote:
> 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"  
> argument.
> 
> 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
> 
> 	plot(c(1,2),c(3,4),ylim=c(3,4),asp=1)
> 
> 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
> 
> 	plot(c(1,2),c(3,4),yaxp=c(3,4,1),asp=1)
> 
> or
> 
> 	plot(c(1,2),c(3,4),yaxp=c(3,4,1),asp=1,yaxs="i")
> 
> 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
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list