我想让图表上的每个点的颜色与线条不同。这是示例数据。
df <- structure(list(yrmonth = structure(c(17167, 17167, 17167, 17198,
17198, 17198, 17226, 17226, 17226, 17257, 17257, 17257), class = "Date"),
index = structure(c(2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L,
1L, 3L), .Label = c("E-W", "N-S", "OS"), class = "factor"),
N = c(2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1), data = c(129,
141, 27, 150.5, 209, 87, 247.5, 243, 188, 223, 226.5, 170
)), .Names = c("yrmonth", "index", "N", "data"), row.names = 31:42, class = "data.frame")
这是我的情节代码。
df$yrmonth <- lubridate::ymd(df$yrmonth)
ggplot(df, aes(x=yrmonth,y=data,colour=factor(index), group=index)) +
geom_line(size=.4) +
geom_point(size=1)
我希望绿点是深绿色,橙色点是深橙色,依此类推。