[R] How to get correct proportions/bounding box for latex figure?
mobygeek at yahoo.com
Wed Mar 15 05:14:47 CET 2006
--- Duncan Murdoch <murdoch at stats.uwo.ca> wrote:
> The R graphics model is that the drawing surface is
> established first,
> then the things you draw are adjusted to fit in it.
> R won't change the
> shape of the display because you are drawing more
> things on it.
Thanks, this comment clarifies things somewhat.
Though I find it
an odd design choice for R, since it seems to entail
the user has figure out the aspect ratio of the
something that R could easily keep track of as it is
Here's example code, producing 3 scatterplots
(here reusing the same plot for simplicity).
What's desired is that the individual scatterplots
natural aspect, e.g. square, with the axis units being
same for X, Y. And to do this while producing a
bounding box in the .eps file.
As it stands the example code produces a correct
but the scatterplots are too stretched to be usable.
aspect=1/1 in the xyplot() seems to cause the bounding
to be incorrect.
rand1 <- rnorm(50)
rand2 <- rnorm(50)
theplot <- xyplot(rand1 ~ rand2, xlab="x axis",
thefile <- "plotproblem.eps"
trellis.device(postscript, file=thefile, color=F,
print(theplot, split=c(1,1,3,1), more=T)
print(theplot, split=c(2,1,3,1), more=T)
print(theplot, split=c(3,1,3,1), more=F)
> I don't think I understand exactly what you want to
> achieve; sample code
> that produces something close would be helpful (even
> if it comes out the
> wrong shape).
More information about the R-help