Skip to content

ggplot2 - suggestion for facet_wrap/grid

1 message · David Hajage

#
2008/12/3 hadley wickham <h.wickham at gmail.com>
I was sure :-)
OK. I thought that facet_wrap was created to "control" the layout of
facet_grid plot with one-side formula, since a facet_grid plot with one-side
formula should be (almost?) identical with a facet_wrap plot with nrow (or
ncol) = 1.

By the way, I've just test this thing to see the diffences between the two
plots :

d <- ggplot(diamonds, aes(carat, price, fill = ..density..)) +
   xlim(0, 2) + stat_binhex(na.rm = TRUE) + opts(aspect.ratio = 1) ## from
official documentation
d + facet_grid(~ color)
d + facet_wrap(~ color)
d + facet_wrap(~ color, nrow = 1)
Erreur dans rep(list(nullGrob()), nrow * ncol - length(vec)) :
  argument 'times' incorrect

Is this error normal ? facet_wrap must always give a 2d ribbon of panels ?

Thank you very much for your patience.

david