3

I am still struggling with correct labels of my plots. I managed to get this to work.

df <-data.frame(a=seq(1,20),b=seq(1,20))
ggplot(df, aes(x = a, y = b)) + geom_point() +
  ylab(expression(paste(CH[4]~" formation rate"~"(",mu, mol, day^{-1},")")))

What it is missing is the operator sign " * " between mumol and day^-1. It should look like this: enter image description here Thank you for your help.

nouse
  • 3,315
  • 2
  • 29
  • 56

1 Answers1

6

I prefer not to use the paste style for expressions but to use ~ and * to separate terms with or without a space respectively. If you want an *, put it in quotes.

ggplot(df, aes(x = a, y = b)) + 
  geom_point() + 
  ylab(expression(CH[4]~formation~rate~(mu*mol~'*'~day^{-1}))) 
Richard Telford
  • 9,558
  • 6
  • 38
  • 51