Axis title containing texts with exponents

58 Views Asked by At

I'm using ggplot2 to plot a chart. I want to add an exponent to a text within the Y-axis title, so it would look like this:

Energy (kcal ∙ mol-1)

I usually write the axis title text inside labs () and its aesthetic inside theme (axis.title.y = element_text ()). I've seen this answer, but I couldn't understand any of it...

1

There are 1 best solutions below

1
Gerald T On BEST ANSWER

Probably a duplicate question. Check this question for detailed answers.

You can build an expression

ggplot() + geom_point(aes(x=1, y=1)) + 
  labs(y=expression('Energy (kcal '~mol^-1*')'))

plot