View source: R/ggstrat-plot_addons.R
sequential_layer_facets | R Documentation |
Normally, facets are ordered using as.factor on all values that occur within layer data, which means that when adding additional layers, any ordering is not preserved unless the factor levels are identical on all factors. This function changes this behaviour such that facet levels are combined in layer order. This is useful when adding standalone layers to a plot without disturbing the existing order.
sequential_layer_facets(reverse = FALSE)
reverse |
Use TRUE to process layers in reverse order |
An object that can be added to a ggplot2::ggplot()
library(ggplot2) p <- ggplot(mapping = aes(x, y)) + geom_point(data = data.frame(x = 1:5, y = 1:5, facet = "b")) + geom_point(data = data.frame(x = 1:5, y = 1:5, facet = "a")) + facet_wrap(vars(facet)) p p + sequential_layer_facets()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.