facet_grid2 | R Documentation |
This function behaves like ggplot2::facet_grid with default arguments, but has a few extra options. It can draw partial or full axis guides at inner panels, and position scales can be independent.
facet_grid2(
rows = NULL,
cols = NULL,
scales = "fixed",
space = "fixed",
axes = "margins",
remove_labels = "none",
independent = "none",
shrink = TRUE,
labeller = "label_value",
as.table = TRUE,
switch = NULL,
drop = TRUE,
margins = FALSE,
render_empty = TRUE,
strip = strip_vanilla()
)
rows , cols |
A set of variables or expressions quoted by
For compatibility with the classic interface, |
scales |
A
|
space |
A
|
axes |
A
|
remove_labels |
A
|
independent |
A
|
shrink |
If |
labeller |
A function that takes one data frame of labels and
returns a list or data frame of character vectors. Each input
column corresponds to one factor. Thus there will be more than
one with |
as.table |
If |
switch |
By default, the labels are displayed on the top and
right of the plot. If |
drop |
If |
margins |
Either a logical value or a character
vector. Margins are additional facets which contain all the data
for each of the possible values of the faceting variables. If
|
render_empty |
A |
strip |
An object created by a call to a strip function, such as
|
Both the independent
and space
arguments only have an effect
when the scales
argument in a dimension is free. However, the
independent
and space
arguments can not be used to simultaneously set
an independent scale and have the panel size be proportional to that scale.
A Facet
ggproto object that can be added to a plot.
Other facetting functions:
facet_manual()
,
facet_nested_wrap()
,
facet_nested()
,
facet_wrap2()
p <- ggplot(mpg, aes(displ, hwy)) + geom_point()
# Repeat all axes for every facet
p + facet_grid2(cyl ~ drv, axes = "all")
# Repeat only y-axes
p + facet_grid2(cyl ~ drv, axes = "y")
# Repeat axes without x-labels
p + facet_grid2(cyl ~ drv, axes = "all", remove_labels = "x")
# Grid facets with independent axes for every panel
p + facet_grid2(cyl ~ drv, scales = "free", independent = "all")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.