我想在ggplot中的情节label
中写微米平方/立方米,当我添加m ^ 2时出现错误。第一个表达式还可以,但它缺少^ 2。我尝试添加m ^ 2不起作用,因为我没有看到上标。
ylab (expression(paste("Surface area concentration (",mu,"m/",m^3,")", sep="")))
ylab (expression(paste("Surface area concentration (",mu,",m^2,"/,m^3,")", sep="")))
谢谢
答案 0 :(得分:8)
这只是一个引用问题:
library(ggplot2)
qplot(mpg, wt, data = mtcars) +
ylab (expression(paste(
"Surface area concentration (",
mu, m^2, "/", m^3,
")", sep="")))
答案 1 :(得分:6)
试试这个:
qplot(0, ylab = ~ "Surface area concentration ( " * mu * m^2 / m^3 * ")")
答案 2 :(得分:1)
或者,甚至更短:
plot(0, ylab = ~ "Surface area concentration" (mu * m^2 / m^3))
plot(0, ylab = Surface~area~concentration (mu * m^2 / m^3))