如何在ggplot中说明图例?

时间:2018-08-05 17:14:45

标签: r ggplot2 graph device

我只想添加这四个变量的图例,但是我无法在R中执行此操作。如何在图形中添加图例?

`ggplot(items, aes(No)) +   geom_line(aes(y = InflaCounts), group = 

1,color = "green", size=0.5) +
  geom_line(aes(y = FactorCounts), group = 1,color = "red", size=0.5) +
  geom_line(aes(y = MonetaryCounts), group = 1,color = "blue", size=0.5) +
  geom_line(aes(y = Total), group = 1,color = "brown", size=0.5) +
  scale_x_discrete(breaks = breakings) + theme(axis.text.x = element_text(angle = 90, hjust = 1)) +
  labs(x='SMPCM No.', y='Number of Words')

`

0 个答案:

没有答案