[R] Setting the width and height of a Sweave figure
Henrik Andersson
h.andersson at nioo.knaw.nl
Thu Jan 13 10:12:26 CET 2005
Hello R-people,
I have a function which plots two figures next to each other
using if(dev.cur()==1) x11(width=14,height=7) to create a new window
and set the size of the window automatically if no device is open.
This works fine in interactive mode but I don't know how Sweave gets the
parameters for the figures, and right now the default behavior causes
this figure to be square and the subfigures becomes not no square,
making them look silly.
I want a general solution so my function can be used in both interactive
mode and in a sweave file.
Thanks, Henrik Andersson
---------------------------------------------------------
<<>>=
myfun <- function(){
if(dev.cur()==1) x11(width=14,height=7)
par(mfrow=c(1,2))
plot(1:5)
plot(1:5)
}
<<fig=TRUE>>=
myfun()
---------------------------------------------
Henrik Andersson
Netherlands Institute of Ecology -
Centre for Estuarine and Marine Ecology
P.O. Box 140
4400 AC Yerseke
Phone: +31 113 577473
h.andersson at nioo.knaw.nl
http://www.nioo.knaw.nl/ppages/handersson
More information about the R-help
mailing list