【发布时间】:2020-03-25 02:00:57
【问题描述】:
我想添加一个图例,它只描述我的情节中的线条,类似于这个:
library(ggplot)
df<-as.data.frame(cbind(seq(1:10), seq(from=2, to=20, 2)))
ggplot(data=df, aes(V1, V2))+geom_point()+
geom_abline(intercept=0, slope=1)
我只想将 abline 添加到图例中。我已经尝试使用 geom_line,但是当我调整绘图的 x 和 ylims 时它消失了。 ggplot2 没有从头开始构建类似于 lattice 的图例的选项,是吗?
【问题讨论】: