这肯定是一个简单的问题,但我找不到快速简便的解决方案。 我只是想从图例中删除一个aes,例如在图中,我不希望出现“2点”:
顺便说一下,这就是情节的代码:
ggplot(subset(df, df$ID %in% c( "B4F", "B3F", "B33F", "B2F", "B0F")),
aes(Date, SO4, color=ID))+
geom_smooth(method="loess", se=F, size=1)+
geom_point(data=subset(df_1, df_1$ID %in% c( "B4F", "B3F", "B33F", "B2F", "B0F")),
aes(Date, SO4, color=ID, size=2, legend=FALSE))+
scale_x_date(labels= date_format("%Y"), breaks=date_breaks("year"))+
xlab(NULL)
答案 0 :(得分:1)
从size=2
中删除aes
。因此,改变
geom_point(data=subset(df_1, df_1$ID %in% c( "B4F", "B3F", "B33F", "B2F", "B0F")),
aes(Date, SO4, color=ID, size=2, legend=FALSE))
到
geom_point(data=subset(df_1, df_1$ID %in% c( "B4F", "B3F", "B33F", "B2F", "B0F")),
aes(Date, SO4, color=ID, legend=FALSE), size=2)
在后一段代码中,size=2
仍在geom_point
内,但在aes
之外。