Re: [R] Computing plot size in Sweave

2012-02-20 Thread Yihui Xie
Yes, with the old good cat() and results=tex, you can do anything. It is just so unnatural. Why must a simple task like setting the size of a plot involve with so much coding work? % complete knitr code <>= opts_knit$set(eval.opts = c('fig.height', 'fig.width')) my.height = 6; my.width = 7 @ <>=

Re: [R] Computing plot size in Sweave

2012-02-20 Thread Marc Schwartz
On Feb 20, 2012, at 9:15 AM, BXC (Bendix Carstensen) wrote: > Sometimes you want to compute the physical size of a plot based on data. > In R itself this is no problem. > > But is there a way to compute the values of height and width in S-weave, say: > > <>= > > where xx and yy are computed and

Re: [R] Computing plot size in Sweave

2012-02-20 Thread Yihui Xie
I guess that is not possible with Sweave, but it is possible in the knitr package (an alternative to Sweave). You can set opts_knit$set(eval.opts = c('fig.height', 'fig.width')) so that these two options will be evaluated as R expressions (e.g. fig.height=x means it takes value from a variable x)