ggplot多个图例多个图

时间:2018-02-16 01:38:58

标签: r ggplot2

使用ggplot2绘制来自25个站点(ID)的组(gp)的时间序列的多个图。

df3[1:5,]
  year  ID val gp 
1 1985 ID1   5  1
2 1986 ID1   5  1
3 1987 ID1  19  1
4 1988 ID1  20  1
5 1989 ID1  21  1

P<- ggplot(df3, aes(as.numeric(year), val, colour=ID)) + 
  geom_line() + 
  facet_wrap(~gp)+ 
  theme(strip.background = element_rect("transparent",colour = NA))+
  theme(strip.text.x = element_text(size = 17, face="bold", colour = "black"))+
  ylab( "Frequency                                  Frequency" ) + 
  xlab("")+
  theme(axis.text=element_text(size=14, face="bold", color = "black"),
        axis.title=element_text(size=17,face="bold"))
P

enter image description here

您可以看到很难使用图例来了解每个地块的网站(ID)。 有没有办法为每个面板添加图例而不是一个图例。

0 个答案:

没有答案
相关问题