Reputation: 143
I want to have -1 in an axis title with the -1 being superscript. The title on my y
axis should read "Ba:Ca (µmol:mol-1)"
with the -1 as superscript. I have tried ^
before the -1 and also the expression function to no avail. R
Rookie, please help.
Upvotes: 2
Views: 957
Reputation: 78927
Alternatively we could use bquote
ggplot()+
geom_point(data=mtcars, aes(cyl,mpg))+
labs(y = bquote('Ba:Ca'~(µmol<.mol^-1)))
Upvotes: 1
Reputation: 1332
Is this something you want?
set.seed(4)
x <- runif(20, 5, 10)
y <- runif(20, 15, 20)
df <- data.frame(x,y)
ggplot()+
geom_point(data=df, aes(x,y))+
labs(y = expression(paste('Ba:Ca (µmol:mol'^-1,')')), x = "x axis")
Upvotes: 3