View source: R/facet_nested_wrap.R
facet_nested_wrap | R Documentation |
facet_nested_wrap()
wraps a sequence of panels onto a two-dimensional
layout, and nests grouped facets where possible.
facet_nested_wrap(
facets,
nrow = NULL,
ncol = NULL,
scales = "fixed",
axes = "margins",
remove_labels = "none",
shrink = TRUE,
labeller = "label_value",
as.table = TRUE,
drop = TRUE,
dir = "h",
strip.position = "top",
nest_line = element_line(inherit.blank = TRUE),
solo_line = FALSE,
resect = unit(0, "mm"),
trim_blank = TRUE,
strip = strip_nested(),
bleed = NULL
)
This function inherits the capabilities of
facet_wrap2()
.
This function only merges strips in the same row or column as they appear
through regular facet_wrap()
layout behaviour.
Hierarchies are inferred from the order of variables supplied to
facets
. The first variable is interpreted to be the outermost
variable, while the last variable is interpreted to be the innermost
variable. They display order is always such that the outermost
variable is placed the furthest away from the panels. For more information
about the nesting of strips, please visit the documentation of
strip_nested()
.
A FacetNestedWrap
ggproto object that can be added to a plot.
See strip_nested()
for nested strips. See
ggplot2::facet_wrap()
for descriptions of the original
arguments. See grid::unit()
for the construction of a
unit
vector.
Other facetting functions:
facet_grid2()
,
facet_manual()
,
facet_nested()
,
facet_wrap2()
# A standard plot
p <- ggplot(mpg, aes(displ, hwy)) +
geom_point()
# Similar to `facet_wrap2(..., strip = strip_nested())`.
p + facet_nested_wrap(vars(cyl, drv))
# A nest line inherits from the global theme
p + facet_nested_wrap(vars(cyl, drv),
nest_line = element_line(colour = "red")) +
theme(ggh4x.facet.nestline = element_line(linetype = 3))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.