[R] ggplot2 facets as rows and columns

hadley wickham h.wickham at gmail.com
Thu Nov 8 16:35:41 CET 2007


On 11/8/07, ONKELINX, Thierry <Thierry.ONKELINX at inbo.be> wrote:
> You could work around it like this.
>
> n <- length(levels(TDBU$system))
> rows <- ceiling(sqrt(n))
> TDBU$rows <- ceiling(as.numeric(TDBU$system) / rows)
> TDBU$cols <- (as.numeric(TDBU$system) - 1)  %% rows
>
> ggplot(TDBU,aes(x=x))+geom_histogram(aes(y=..density..))+ geom_density()
> + facet_grid(rows ~ cols)

Yes, that's the best you can do at the moment.  I'm hoping to add a
more lattice-like facetting over Christmas.  Keep your fingers
crossed!

Hadley

-- 
http://had.co.nz/



More information about the R-help mailing list