I'm using Sweave to generate LaTeX output from R. Thank-you very much for this capability. It is very useful. Could someone please tell me how to pass non-default graphics parameters from par() to the pdf driver when it is called by Sweave? (I need to change some of the margin defaults. ) Hoping there is an easy solution to this question, Anne York
Sorry for wasting the list for this. Had a blind spot. It is very easy. Just include the par() commands inside the R chunks that generate the plots. Anne On Thu, 4 Dec 2003, Anne York wrote:> I'm using Sweave to generate LaTeX output from R. Thank-you > very much for this capability. It is very useful. > > Could someone please tell me how to pass non-default > graphics parameters from par() to the pdf driver when it is > called by Sweave? > > (I need to change some of the margin defaults. ) > > Hoping there is an easy solution to this question, > > Anne York > > >
Friedrich.Leisch@ci.tuwien.ac.at
2003-Dec-05 07:15 UTC
[R] passing par() options to pdf under Sweave
>>>>> On Thu, 4 Dec 2003 15:58:32 -0800 (PST), >>>>> Anne York (AY) wrote:> I'm using Sweave to generate LaTeX output from R. Thank-you > very much for this capability. It is very useful. > Could someone please tell me how to pass non-default > graphics parameters from par() to the pdf driver when it is > called by Sweave? > (I need to change some of the margin defaults. ) > Hoping there is an easy solution to this question, Yes, simply define a hook function for figure chunks: The effect of options(SweaveHooks=list(fig=function() par(bg="red", fg="blue"))) should be easy to see :-) The hook function will be executed at the beginning of each chunk where fig=true (i.e., all figure chunks). What you want is something like options(SweaveHooks=list(fig=function() par(mar=c(1,2,3,4)))) Hope this helps, -- ------------------------------------------------------------------- Friedrich Leisch Institut f?r Statistik Tel: (+43 1) 58801 10715 Technische Universit?t Wien Fax: (+43 1) 58801 10798 Wiedner Hauptstra?e 8-10/1071 Friedrich.Leisch at ci.tuwien.ac.at A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch