[R] Re-sizing R graphics for Sweave

Marc Schwartz marc_schwartz at comcast.net
Wed May 16 22:45:32 CEST 2007


On Wed, 2007-05-16 at 16:34 -0400, Thomas Adams wrote:
> I am generating a single graphic containing about 31 Boxplots; the issue 
> I am having is that not all the labels (3 characters each) are shown. 
> Interactively, within a R session, I can simply re-size the graphics 
> window and all the labels appear. But, what can I do non-interactively 
> to have all the labels displayed when using Sweave? Can the labels be 
> rotated 90-degrees; would this help? I guess one possibility would be to 
> number the boxplots, but this may not help either. My thought would be 
> to force the graphic to be a certain width, but I can't find how to do this.
> 
> I have searched and can not find a way to do this automatically — I 
> could not find anything in the "R Graphics" book by Paul Murrell that 
> pointed me in the right direction either.
> 
> Thank you,
> Tom

Presuming that you are using a 'figure' chunk in your .Rnw file, you can
use:

  <<fig=TRUE,height=8,width=6.5>>=

     Your R code here...

  @


which will define the dimensions of your plot output file as 8 x 6.5.
Adjust these as you require.

See ?RweaveLatex

You may also need to adjust the size of the titles, etc. in the plots,
which you can do with the various 'cex' family of parameters. See ?par
for more information there.

HTH,

Marc Schwartz



More information about the R-help mailing list