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

label_parse(labels)

Arguments

labels

character vector of labels to be parsed

Value

a list of expressions

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.

Examples

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)