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). Note width/height have been renamed to fig.width/fig.height in knitr. See http://yihui.name/knitr/ Regards, Yihui -- Yihui Xie <xieyi...@gmail.com> Phone: 515-294-2465 Web: http://yihui.name Department of Statistics, Iowa State University 2215 Snedecor Hall, Ames, IA On Mon, Feb 20, 2012 at 9:15 AM, BXC (Bendix Carstensen) <b...@steno.dk> 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: > > <<graph,fig=TRUE,height=xx,width=yy>>= > > where xx and yy are computed and not physically written in the document? > > Bendix > ______________________________________________ > > Bendix Carstensen > Senior Statistician > Epidemiology > > Steno Diabetes Center A/S > Niels Steensens Vej 2-4 > DK-2820 Gentofte > Denmark > +45 44 43 87 38 (direct) > +45 30 75 87 38 (mobile) > b...@steno.dk http://BendixCarstensen.com > www.steno.dk > > This e-mail (including any attachments) is intended for ...{{dropped:8}} > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.