[R] Re-sizing R graphics for Sweave

Douglas Bates bates at stat.wisc.edu
Thu May 17 14:09:21 CEST 2007


On 5/16/07, Thomas Adams <Thomas.Adams at noaa.gov> wrote:
> Marc,
>
> That did it! Thank you so much for your help…
>
> Regards,
> Tom
>
>
> Marc Schwartz wrote:
> > 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.

Another approach is to use horizontal boxplots.  With the lattice
package you can use

library(lattice)
bwplot(grps ~ obs, mydata)

If you prefer to use the boxplot function then use the optional
argument horizontal = TRUE.

> >> 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
> >
> >
> >
>
>
> --
> Thomas E Adams
> National Weather Service
> Ohio River Forecast Center
> 1901 South State Route 134
> Wilmington, OH 45177
>
> EMAIL:  thomas.adams at noaa.gov
>
> VOICE:  937-383-0528
> FAX:    937-383-0033
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>



More information about the R-help mailing list