这是我的代码:
clist <- list(c(1:39), c(2:40), c(3:41))
clist.ts <- lapply(clist, function(x) ts(x, frequency = 1, start = 1978))
ind78_ymean_tsdf <- as.data.frame(clist.ts)
names(ind78_ymean_tsdf) <- c("name1", "name2", "name3")
ind78_ymean_tsdf$"Year" <- c(1978:2016)
(ggplot(ind78_ymean_tsdf, aes(x=Year))
+ geom_line(aes(y=name1, color="Name One") )
+ geom_line(aes(y=name2, color="Name Two") )
+ geom_line(aes(y=name3), color="black", size=1.5 )
+ labs(title="Development of the indices", x="Year", y="Index")
+ scale_color_discrete(name="Individual replications"))
不幸的是,在将name3
变量颜色更改为黑色之后,它不再以某种方式显示在图例中。我想改变它,但不知道该怎么做。有什么建议?
PS。这就是情节如何: