【发布时间】:2012-10-13 20:02:26
【问题描述】:
我在 ggplot 中有一条水平线,我想在 y 轴上标记它的值 (7.1)。
library(ggplot2)
df <- data.frame(y=c(1:10),x=c(1:10))
h <- 7.1
plot1 <- ggplot(df, aes(x=x,y=y)) + geom_point()
plot2 <- plot1+ geom_hline(aes(yintercept=h))
感谢您的帮助。
【问题讨论】:
-
刚刚问了一个有关以编程方式标记多个 ablines here 的相关问题,如果将来有人碰巧正在寻找它(就像我发现这个时一样)。