This function can be passed to the labeller argument of ggplot2::facet_wrap() or ggplot2::facet_grid(). Labels are processed using parse_label().

parse_label(x)

look_for_tex(x)

label_tex(x)

label_parse_label(x)

Arguments

x

Data frame of labels.

Details

The label can include TeX math expressions (more common) or plotmath.

TeX math expressions are detected if more than two $ are detected in the string. Parsing is accomplished with the TeX function from the latex2exp package; a warning if thelatex2exp is not available.

Text to be parsed as plotmath is detected when the text begins with !!.

Examples

parse_label("foo $\\mu$")
#>    LaTeX: foo $\mu$ 
#> plotmath: 'foo '*mu 
parse_label("!!mu")
#> expression(mu)