label_bquote: Label with mathematical expressions

Description Usage Arguments See Also Examples

View source: R/labeller.r

Description

label_bquote() offers a flexible way of labelling facet rows or columns with plotmath expressions. Backquoted variables will be replaced with their value in the facet.

Usage

1
label_bquote(rows = NULL, cols = NULL, default = label_value)

Arguments

rows

Backquoted labelling expression for rows.

cols

Backquoted labelling expression for columns.

default

Default labeller function for the rows or the columns when no plotmath expression is provided.

See Also

labellers, labeller(),

Examples

1
2
3
4
5
6
# The variables mentioned in the plotmath expression must be
# backquoted and referred to by their names.
p <- ggplot(mtcars, aes(wt, mpg)) + geom_point()
p + facet_grid(vs ~ ., labeller = label_bquote(alpha ^ .(vs)))
p + facet_grid(. ~ vs, labeller = label_bquote(cols = .(vs) ^ .(vs)))
p + facet_grid(. ~ vs + am, labeller = label_bquote(cols = .(am) ^ .(vs)))

SahaRahul/ggplot2 documentation built on May 17, 2019, 1:46 p.m.