Description Usage Arguments Details Value References See Also Examples
Allows for the use of expressions with facet titles.
1 | facet_wrap_labeller(gg.plot, labels = NULL)
|
gg.plot |
a ggplot object |
labels |
labels for each facet. |
A function to label facetted ggplots
This function alters the lables of a facetted ggplot object. This is useful if you want use expressions or have a simple way to mdify the labels of a facetted ggplot object.
a ggplot object with new facet titles.
http://stackoverflow.com/questions/11979017
plotmath
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ## Add a factor to the cars example data to facet the plots
library(ggplot2)
x_cars <- data.frame(cars, variable = sample(letters[1:5],
50,
replace = TRUE))
## Create the plot with facets
plt <- ggplot() + geom_point(aes(speed, dist), x_cars) +
facet_wrap(~variable, ncol=1)
plt
## An example without labels - no real point in this.
library(gridExtra)
facet_wrap_labeller(plt)
## Adding expressions within the facet labels.
facet_wrap_labeller(plt, labels = c(expression(a^2),
expression(b[1]),
expression(frac(c,2)),
"d",
expression(infinity)))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.