Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

gf_facet_grid

Add facets to a plot


Description

These functions provide more control over faceting than is possible using the formula interface.

Usage

gf_facet_wrap(object, ...)

gf_facet_grid(object, ...)

Arguments

object

A ggplot object

...

Additional arguments passed to facet_wrap() or facet_grid(). This typically includes an unnamed formula argument describing the facets. scales and space are additional useful arguments. See the examples.

See Also

Examples

gf_histogram(~avg_drinks, data = mosaicData::HELPrct) %>%
  gf_facet_grid(~substance)
gf_histogram(~avg_drinks, data = mosaicData::HELPrct) %>%
  gf_facet_grid(~substance, scales = "free")
gf_histogram(~avg_drinks, data = mosaicData::HELPrct) %>%
  gf_facet_grid(~substance, scales = "free", space = "free")
gf_line(births ~ date, data = mosaicData::Births, color = ~wday) %>%
  gf_facet_wrap(~year, scales = "free_x", nrow = 5) %>%
  gf_theme(
    axis.title.x = element_blank(),
    axis.text.x = element_blank(), axis.ticks.x = element_blank()
  ) %>%
  gf_labs(color = "Day")

ggformula

Formula Interface to the Grammar of Graphics

v0.10.1
MIT + file LICENSE
Authors
Daniel Kaplan [aut], Randall Pruim [aut, cre]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.