
Arrange Facets for your ggplot object
facet_warp.RdArrange Facets for your ggplot object
Usage
facet_warp(
facets,
macro_x,
macro_y,
nrow = NULL,
ncol = NULL,
strip.position = "top",
labeller = "label_value"
)Arguments
- facets
A variable, quoted by vars(), defining faceting groups
- macro_x
the name of a column which shall be used to arrange facets horizontally
- macro_y
the name of a column which shall be used to arrange facets vertically
- nrow, ncol
Number of rows and columns.
- strip.position
By default, the labels are displayed on the top of the plot. Using
strip.positionit is possible to place the labels on either of the four sides by settingstrip.position = c("top", "bottom", "left", "right")- 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
vars(cyl, am). Each output column gets displayed as one separate line in the strip label. This function should inherit from the "labeller" S3 class for compatibility withlabeller(). You can use different labeling functions for different kind of labels, for example uselabel_parsed()for formatting facet labels.label_value()is used by default, check it for more details and pointers to other options.
Examples
ggplot(iris)+
geom_point(aes(x=Petal.Width, y=Petal.Length))+
facet_warp(vars(Species), macro_x='Sepal.Width', macro_y='Sepal.Length', nrow = 2)
#> Error in ggplot(iris): could not find function "ggplot"