我想使每个点图形上的从线不同的颜色更暗的颜色。这里是示例数据。GGPLOT2:使线路上的点比线颜色
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)
我想绿点是一个更深的绿色,橙色的点是一个更暗的橙色等等。
一个快速的解决办法是使用'geom_line(大小= 0.4,α-= 0.5)',这使得线条更透明的,因此它看起来像点是暗。 – user3640617