# A standard plot
p <- ggplot(mpg, aes(displ, hwy)) +
geom_point()
# Typical use
p + facet_wrap2(
~ class,
strip = strip_tag()
)
# Adjusting justification
p + facet_wrap2(
~ class,
strip = strip_tag(just = c(1, 0))
)
p + facet_wrap2(
~ drv + year,
strip = strip_tag()
)
# With a grid layout, you can control in which order the labels are drawn
p + facet_grid2(
"vertical" ~ "horizontal",
strip = strip_tag(order = c("x", "y")) # default
)
p +facet_grid2(
"vertical" ~ "horizontal",
strip = strip_tag(order = c("y", "x")) # invert order
)
Run the code above in your browser using DataLab