parse_label: Parse the label part of a col_label

View source: R/utils.R

parse_labelR Documentation

Parse the label part of a col_label

Description

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

Usage

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$")
parse_label("!!mu")


metrumresearchgroup/pmplots documentation built on Oct. 15, 2024, noon