[R] Fancy Page layout

baptiste auguie baptiste.auguie at googlemail.com
Mon May 31 20:47:01 CEST 2010


ggplot2 or lattice could help you in creating the plots. Adding a
summary will however require some play with Grid graphics; either
using gridBase to mix lattice / ggplot2 output with base R graphics
(e.g. textplot() from some package I forget), or you'll need to
produce the textual summary in some form that Grid understands (of
course, LaTeX / Sweave is a good option for this step too). A pure
Grid graphics example is illustrated below,

library(gridExtra) # R-forge


onelevel <- function(d){

  plots <- qplot(depth, table, data=d, colour=clarity) + facet_wrap(~cut)
  tab <- tableGrob(head(d))
  plotsandtable <- c(list(plots), list(tab), list(plot=FALSE,
  do.call(arrange, plotsandtable)


l <- dlply(diamonds, .(color), onelevel)

l_ply(l, function(page) {grid.newpage(); grid.draw(page)} )



On 31 May 2010 20:16, Noah Silverman <noah at smartmediacorp.com> wrote:
> Hi,
> Working on a report that is going to have a large number of graphs and
> summaries.  We have 80 "groups" with 20 variables each.
> Ideally, I'd like to produce ONE page for each group.  It would have two
> columns of 10 graphs and then the 5 number summary of the variables at
> the bottom.
> So, perhaps the top 2/3 of the page has the graphs and the bottom third
> has 20 rows of data summary(maybe a table of sorts.)
> This COULD be done in Latex, but would have to be hand coded for each of
> the 80 groups which would be painfully slow.
> I can easily do the graphs with par(mfrow=c(5,2))  band then draw the
> graphs in a loop.
> But I am stuck from here:
> 1) How do I control the size of the plot window.  (Ideally, it should
> print to fill an 8.5 x 11 piece of paper)
> 2) Is there a way to "easily" insert a 5 number summary (summary
> command) into the lower half of the page.
> Does anybody have any ideas??
> Thanks!
> ______________________________________________
> R-help at 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.


Baptiste Auguié

Departamento de Química Física,
Universidade de Vigo,
Campus Universitario, 36310, Vigo, Spain

tel: +34 9868 18617

More information about the R-help mailing list