Add facet headers to facet_grid #654

wants to merge 1 commit into

3 participants


This is a first pass at adding facet headers. Examples here:

Things that need to be done:

  • Improve appearance
  • Decide whether to allow this for facet_wrap, and if so, how
  • Control over whether each header is drawn
  • Syntax for setting header labels to something other than the default
  • Figure out what to do when facet has two variables on one axis, like facet_grid(. ~ am + cyl)

Maybe the labels could be controlled like this:

facet_grid(am ~ cyl, titles = "auto/manual" ~ NULL)

Where NULL means not to draw facet headers for that variable.

@krlmlr krlmlr referenced this pull request in wch/ggplot2 Dec 11, 2013

Merge to current master #5

@krlmlr krlmlr commented on the diff Dec 11, 2013
@@ -50,6 +50,9 @@ theme_grey <- function(base_size = 12, base_family = "Helvetica") {
strip.background = element_rect(fill = "grey80", colour = NA),
strip.text.x = element_text(),
strip.text.y = element_text(angle = -90),
+ strip.title.background = element_rect(fill = "grey80", colour = NA),
krlmlr Dec 11, 2013

I think this one should be a bit lighter than the background for the strip, in particular it should be white for theme_bw.


I have an implementation for

Syntax for setting header labels to something other than the default

using the labeller (called with value = NULL). Would you be available to review it?


Could you please rebase/merge against master, re-document with the development version of roxygen2 (install_github("klutometis/roxygen) and resubmit?

@hadley hadley closed this Feb 24, 2014

@wch: Would you like to collaborate on this feature?


@krlmlr Unfortunately, I'm pretty busy with other stuff at the moment. I'm happy to look at whatever you come up with though. Feel free to base it off this if you want.


@wch: Please see wch/ggplot2#6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment