如何在ggplot中添加图例?

时间:2017-11-14 17:49:37

标签: r ggplot2

我有这个情节,这是用于生成它的代码:

enter image description here

df <- data.frame(MO, -log(GC1), -log(GC2))
colnames(df) <- c("MO", "IPs -> DLPFc", "DLPFc -> IPs")

ggplot(df, aes(x = MO, y = -log(GC1)), geom = c("point", "smooth")) + 
  geom_line(aes(y = -log(GC1), linetype = "IPs -> DLPFc")) + 
  labs(x = "Model Order", y = "-Log(P-Value)", title = "Granger Causality") + 
  geom_hline(yintercept = 1.3, col='green') + 
  geom_point() + 
  geom_smooth() + 
  geom_line(aes(y = -log(GC2), linetype = "DLPFc -> IPs"), col = 'red')

如何获取正确的图例,指定具有正确方向的线条?谢谢!

0 个答案:

没有答案