label_parse: ggplot2 labeller function for plotmath labels

Description Usage Arguments Details Value Examples

View source: R/generics.R

Description

ggplot2 labeller function for plotmath labels. To be used in ggplot2 scale_*_ functions as the label argument.

Usage

1

Arguments

labels

character vector of labels to be parsed

Details

It is useful when breaks are plotmath-ready character vectors. This function correctly formats them in order to be parsed and displayed as expressions.

Value

a list of expressions

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
df <- data.frame(
   var = c('x[1]', 'x[2]', 'x[3]', 'alpha'),
   value = c(1,2,3,4)
)

library(ggplot2)

ggplot(df) +
   geom_point(aes(x = var, y = value)) +
   scale_x_discrete(label = label_parse)

lgaborini/rstanBF documentation built on March 10, 2021, 1:12 p.m.