ggplot2中的打印命令无法显示图例

时间:2019-03-29 16:16:10

标签: r ggplot2

在您的帮助下,我混合了我的地块,但是现在还有另一个问题,图例不出现。你能帮我吗?

z <- ggplot(a1994, aes(BOTTOM_TEMPERATURE_BEGINNING,SHOOTING_DEPTH)) + geom_point() + 
  geom_line(fill="blue", colour="darkblue", size=1)

z <- z + geom_point(data=a2005, aes(BOTTOM_TEMPERATURE_BEGINNING,SHOOTING_DEPTH)) + 
  geom_line(data=a2005, fill="red", colour="red", size=1)

z <- z + geom_point(data=a2016, aes(BOTTOM_TEMPERATURE_BEGINNING,SHOOTING_DEPTH)) + 
  geom_line(data=a2016, fill="green", colour="green", size=1)
print(z)

编辑:我只能插入一年

> dput(head(a2016, 20))
structure(list(BOTTOM_TEMPERATURE_BEGINNING = c(13.95, 14, 14.05, 
14.06, 14.09, 14.12, 14.16, 14.17, 14.19, 14.22, 14.25, 14.27, 
14.28, 14.34, 14.43, 14.49, 14.53, 14.59, 14.61, 14.62), N = c(432, 
432, 432, 864, 432, 432, 432, 432, 864, 432, 864, 432, 432, 432, 
432, 432, 432, 432, 432, 432), SHOOTING_DEPTH = c(362, 624, 360, 
571, 536, 543, 466, 472, 459.5, 530, 396, 384, 371, 295, 162, 
285, 101, 143, 181, 158), sd = c(0, 0, 0, 6.00347523921406, 0, 
0, 0, 0, 48.5280915169803, 0, 10.0057920653568, 0, 0, 0, 0, 0, 
0, 0, 0, 0), se = c(0, 0, 0, 0.204242375270939, 0, 0, 0, 0, 1.65095920010676, 
0, 0.340403958784899, 0, 0, 0, 0, 0, 0, 0, 0, 0), ci = c(0, 0, 
0, 0.400869909381999, 0, 0, 0, 0, 3.24036510083782, 0, 0.668116515636665, 
0, 0, 0, 0, 0, 0, 0, 0, 0)), row.names = c(NA, 20L), class = "data.frame")

enter image description here

0 个答案:

没有答案