Re: [R] Fancy Page layout
Hello, You can the same as trellis but with the standar graphics library in the direction you are exploring. Use par(mfrow=c(5,2)) to display your graphics. The size and location of the graphics can be managed with the layout() function, present in the graphics library. And with mtext and text functions you can write whatever text you like in any place of your graphics page. Regards, Carlos. On Wed, Jun 2, 2010 at 2:43 AM, Dejian Zhao wrote: > I think you can use grid.layout() to create the appropriate layout, > allocating proper space for the upper plotting area and the bottom text > region, and then use viewport() with the layout parameter to control the > output by pushing the viewport at the proper region on the graphical device. >Viewport alone can solve your three quesions, but with grid.layout the > layout is better controlled. >The above-mentioned functions, or grid.layout(), viewport() and > pushViewport(), are in the grid package. Possibly the work can be done by > combining lattice with grid. > > > On 2010-6-2 1:10, Noah Silverman wrote: > >> Thanks Jim, >> >> That helps. >> >> Ben Bolker had a nice suggestion on how to get the lattice package to >> easily plot all 22 variables in one window. >> >> Ultimately, I'd like to generate a PDF that will print on a standard >> (8.5 x 11) page. >> >> A few things I'm still stuck are: >> 1) How to use the lattice command AND leave room at the bottom for a >> text block >> 2) How to tell lattice the size of the window >> 3) How to integrate all this together - draw a big window, plot >> trellis in the top half and then text box in the bottom. >> >> Any thoughts? >> >> -N >> >> >> On 6/1/10 4:53 AM, Jim Lemon wrote: >> >> >>> On 06/01/2010 04:16 AM, Noah Silverman 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?? >>> Hi Noah, >>> One easy way is to leave some space at the bottom, either by using: >>> >>> par(mfrow=c(6,2)) >>> >>> or the more flexible "layout" function, and then use "text" or a >>> fancier function (textbox, boxed.labels, addtable2plot, etc.) to add >>> your text after: >>> >>> par(xpd=NA) >>> >>> allows you to display the text anywhere you please. If you use a >>> bitmap graphics device, make it big: >>> >>> png("numberoneofeighty.png",850,1100) >>> >>> so that it won't look lumpy on the printed page. >>> >>> Jim >>> >>> >>> >> __ >> 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. > [[alternative HTML version deleted]] __ 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.
Re: [R] Fancy Page layout
I think you can use grid.layout() to create the appropriate layout, allocating proper space for the upper plotting area and the bottom text region, and then use viewport() with the layout parameter to control the output by pushing the viewport at the proper region on the graphical device. Viewport alone can solve your three quesions, but with grid.layout the layout is better controlled. The above-mentioned functions, or grid.layout(), viewport() and pushViewport(), are in the grid package. Possibly the work can be done by combining lattice with grid. On 2010-6-2 1:10, Noah Silverman wrote: Thanks Jim, That helps. Ben Bolker had a nice suggestion on how to get the lattice package to easily plot all 22 variables in one window. Ultimately, I'd like to generate a PDF that will print on a standard (8.5 x 11) page. A few things I'm still stuck are: 1) How to use the lattice command AND leave room at the bottom for a text block 2) How to tell lattice the size of the window 3) How to integrate all this together - draw a big window, plot trellis in the top half and then text box in the bottom. Any thoughts? -N On 6/1/10 4:53 AM, Jim Lemon wrote: On 06/01/2010 04:16 AM, Noah Silverman 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?? Hi Noah, One easy way is to leave some space at the bottom, either by using: par(mfrow=c(6,2)) or the more flexible "layout" function, and then use "text" or a fancier function (textbox, boxed.labels, addtable2plot, etc.) to add your text after: par(xpd=NA) allows you to display the text anywhere you please. If you use a bitmap graphics device, make it big: png("numberoneofeighty.png",850,1100) so that it won't look lumpy on the printed page. Jim __ 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.
Re: [R] Fancy Page layout
Thanks Jim, That helps. Ben Bolker had a nice suggestion on how to get the lattice package to easily plot all 22 variables in one window. Ultimately, I'd like to generate a PDF that will print on a standard (8.5 x 11) page. A few things I'm still stuck are: 1) How to use the lattice command AND leave room at the bottom for a text block 2) How to tell lattice the size of the window 3) How to integrate all this together - draw a big window, plot trellis in the top half and then text box in the bottom. Any thoughts? -N On 6/1/10 4:53 AM, Jim Lemon wrote: > On 06/01/2010 04:16 AM, Noah Silverman 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?? >> > Hi Noah, > One easy way is to leave some space at the bottom, either by using: > > par(mfrow=c(6,2)) > > or the more flexible "layout" function, and then use "text" or a > fancier function (textbox, boxed.labels, addtable2plot, etc.) to add > your text after: > > par(xpd=NA) > > allows you to display the text anywhere you please. If you use a > bitmap graphics device, make it big: > > png("numberoneofeighty.png",850,1100) > > so that it won't look lumpy on the printed page. > > Jim > __ 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.
Re: [R] Fancy Page layout
On 06/01/2010 04:16 AM, Noah Silverman 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?? Hi Noah, One easy way is to leave some space at the bottom, either by using: par(mfrow=c(6,2)) or the more flexible "layout" function, and then use "text" or a fancier function (textbox, boxed.labels, addtable2plot, etc.) to add your text after: par(xpd=NA) allows you to display the text anywhere you please. If you use a bitmap graphics device, make it big: png("numberoneofeighty.png",850,1100) so that it won't look lumpy on the printed page. Jim __ 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.
Re: [R] Fancy Page layout
Lattice looks nice, but how can I put some summary text at the bottom? On 5/31/10 11:27 AM, RICHARD M. HEIBERGER wrote: > Use lattice. > > require(lattice) > ?lattice > ?xyplot > __ 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.
Re: [R] Fancy Page layout
Hi, 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(ggplot2) library(gridExtra) # R-forge str(diamonds) 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, main=paste(unique(d$color do.call(arrange, plotsandtable) } l <- dlply(diamonds, .(color), onelevel) pdf("test.pdf") l_ply(l, function(page) {grid.newpage(); grid.draw(page)} ) dev.off() HTH, baptiste On 31 May 2010 20:16, Noah Silverman 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@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 http://webs.uvigo.es/coloides __ 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.
Re: [R] Fancy Page layout
Use lattice. require(lattice) ?lattice ?xyplot [[alternative HTML version deleted]] __ 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] Fancy Page layout
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@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.