[R] Sweave figure aspect ratio

Werner Wernersen pensterfuzzer at yahoo.de
Sun Sep 9 13:24:09 CEST 2007


Hello,

using Sweave, is there any option to preserve the
original aspect ratio of plots generated from R code?

Consider this Sweave chunk:
<<test,echo=F,fig=T,width=2,height=2>>=
x <- 1:10
y <- sin(x)
par(mar=c(4,4,0,4))
plot(x,y,
     xlab="x label",
     ylab="y label"
     )
@

In Latex, I want to produce a plot of width 2 but
don't care about the height. If I put the width and
height like shown on the example, the box isn't square
any more. But if I put only width or height in the
Sweave option, then the values then the appearance is
totally off. 

Is there any option for Sweave or other possibility to
preserve the ratio of the sides of plots?

Many thanks,
  Werner



More information about the R-help mailing list