[R] ggplot - start axis label with superscript
Tom Walker
tom.n.walker at gmail.com
Tue Oct 14 11:34:21 CEST 2014
Dear help,
I’m stuck trying to begin an axis label in ggplot with a superscript. While I’m fine using expression to insert them in between normal text in an axis label, this doesn’t appear to work at the start of an expression. For example:
mydata <- data.frame(x = 1:10, y = 10:1)
# this works:
ggplot(mydata) +
aes(x = x, y = y) +
geom_line() +
ylab(expression(paste(Incorrect^{14}, "C", sep = "")))
# this doesn’t work (and is what I would like to be able to do):
ggplot(mydata) +
aes(x = x, y = y) +
geom_line() +
ylab(expression(paste(^{14}, "C", sep = "")))
Any help on this issue would be much appreciated!
Many thanks,
Tom
More information about the R-help
mailing list