Re: [R] multiple pages with ggplot2 facet_wrap?
On Wed, Oct 28, 2009 at 8:19 PM, Bill Gillespie bi...@metrumrg.com wrote: I currently use lattice functions to produce multiple pages of plots using the layout argument to specify the number of rows and columns of panels, e.g., xyplot(price ~ carat | clarity, diamonds, layout = c(2, 2)) This results in 2 pages of 4 panels each. diamonds is a data.frame distributed with ggplot2. I would like to do the same with ggplot2 but have been unsuccessful. The following sequence of statements seemed like a logical way to do it: p - ggplot(diamonds, aes(carat, price)) p + geom_point() + facet_wrap(~clarity, ncol = 2, nrow = 2) But they result in the error statement: Error in nrow * ncol : non-numeric argument to binary operator. Is facet_wrap or facet_grid capable of producing multiple pages of plots and, if so, how? Not automatically - it's up to you to figure out how to split the factor levels in pages and then create the appropriate subsets. Hadley -- http://had.co.nz/ __ 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] multiple pages with ggplot2 facet_wrap?
I currently use lattice functions to produce multiple pages of plots using the layout argument to specify the number of rows and columns of panels, e.g., xyplot(price ~ carat | clarity, diamonds, layout = c(2, 2)) This results in 2 pages of 4 panels each. diamonds is a data.frame distributed with ggplot2. I would like to do the same with ggplot2 but have been unsuccessful. The following sequence of statements seemed like a logical way to do it: p - ggplot(diamonds, aes(carat, price)) p + geom_point() + facet_wrap(~clarity, ncol = 2, nrow = 2) But they result in the error statement: Error in nrow * ncol : non- numeric argument to binary operator. Is facet_wrap or facet_grid capable of producing multiple pages of plots and, if so, how? Thanks, Bill William R Gillespie, VP Strategic Modeling Simulation Metrum Research Group LLC 2 Tunxis Road, Suite 112, Tariffville, CT 06081 Direct FAX:919-371-2786, Main:860-735-7043 bi...@metrumrg.com www.metrumrg.com __ 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.