【发布时间】:2014-07-28 00:51:13
【问题描述】:
我想在 ggplot 的文本中添加希腊字母。这是我想做的:
library(ggplot2)
df <- data.frame(x = rnorm(10), y = rnorm(10))
xIntercept <- mean(df$x)
yIntercept <- mean(df$y)
temp <- paste("theta = ", xIntercept) # This Works
ggplot(df, aes(x = x, y = y)) + geom_point() +
annotate("text", x = xIntercept, y = yIntercept, label = temp, color = "blue")
我想用希腊字母 theta 代替“theta”。我试过这个link 但做不到。我尝试了以下代码,但没有任何反应:
temp <- list(bquote(theta == .(xIntercept)))
temp <- bquote(theta == .(xIntercept))
temp <- expression(theta, "=", xIntercept)
temp <- c(expression(theta), paste0("=", xIntercept))
【问题讨论】: