[R] question on axis box with asp=1
Dan.Kelley at dal.ca
Tue Oct 23 13:54:21 CEST 2007
Thanks very much for the reply.
Probably my example was poor. In my real application, I have an 8Mb
data file of ocean properties, that I didn't want to attach. Plus --
and I should have noted this -- I am using coloured filled contours,
so there is a colour bar at the right which uses up space and makes
it a bit hard for me to guess a good width/height ratio for the pdf()
Since I am working with representations of regions of the earth, I
want to get correct coastline shapes, and so I set asp according to
the local latitude for a region of interest. Thus, the width/height
ratio depends on the latitude and longitude range of the individual
plot that I'm making ... with this complicating factor of space used
for the colourbar. (Every graph is different, e.g. the overall graph
might be tall and thin for waters near England, and short and wide
I hope that anyone reading this realizes that my request is simply
that, and not a complaint about R. If the answer is "there's no way
to do what you want, and you must adjust width and height in pdf(),
well that's fine and I greatly appreciate the advice. I've replied
to the whole R-help list (I hope that is correct protocol), in case
anyone later on comes across the question and wants to know how it
Again, Uwe, thanks for the advice.
On 2007-10-23, at 8:36 AM, Uwe Ligges wrote:
> 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
>> 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
>> R-help at r-project.org mailing list
>> PLEASE do read the posting guide http://www.R-project.org/posting-
>> and provide commented, minimal, self-contained, reproducible code.
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