I would like to write micrometer square/cubic meter in my plot label
in ggplot and I got an error when I add m^2. The first expression is ok but it's missing the ^2. My attempt to add m^2 did not work because I did not see the superscript.
ylab (expression(paste("Surface area concentration (",mu,"m/",m^3,")", sep="")))
ylab (expression(paste("Surface area concentration (",mu,",m^2,"/,m^3,")", sep="")))
Thank you
That is just a quote problem:
library(ggplot2)
qplot(mpg, wt, data = mtcars) +
ylab (expression(paste(
"Surface area concentration (",
mu, m^2, "/", m^3,
")", sep="")))
Try this:
qplot(0, ylab = ~ "Surface area concentration ( " * mu * m^2 / m^3 * ")")
Or, even shorter:
plot(0, ylab = ~ "Surface area concentration" (mu * m^2 / m^3))
plot(0, ylab = Surface~area~concentration (mu * m^2 / m^3))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With