Skip to content
Prev 336902 / 398513 Next

Math symbols in ggplot facets

Hi:

You were close...

library(ggplot2)
m <- mpg

# Set the factor labels with plotmath code (note the ==)
m$drv <- factor(m$drv, labels = c("sigma[0] == sqrt(2)",
                                  "sigma[0] == 2 * sqrt(2)",
                                  "sigma[0] == 3 * sqrt(2)"))

ggplot(m, aes(x = displ, y = cty)) + geom_point() +
  facet_grid(. ~ drv, labeller = label_parsed)

Dennis
On Sat, Feb 22, 2014 at 3:24 AM, Lars Bishop <lars52r at gmail.com> wrote: