我的数据:
日期;原始;拟合; phen;噪声;类型;类型2;类型3;类型4
2013-04-16; 0.77; 0.76; NA; NA; 1; 2; 3; 4
2013-04-24; NA; 0.73; NA; 1; 1; 2; 3; 4
2013-05-10; NA; 0.70; 0.11; NA; 1; 2; 3; 4
2013-05-18; 0.68; 0.65; NA; 1; 1; 2; 3; 4
我想绘制原始时间序列X拟合的时间序列,显示一些已检测到的 拟合时间序列上的点以及哪里有噪声。但是一旦要为每种表示形式显示正确的图例,我在使用图例时就会遇到麻烦。
我正在尝试:
ggplot(data=df) + geom_line(data=df, aes(x=Date, y=fitted_data, color= >type2)) + labs(x = "Dates", y="EVI") +
geom_point(data=df, aes(x=Date, y=original_data, color = type)) +
geom_point(data=df, aes(x=Date, y=phen, color = type3), size =3) +
geom_point(data=df, aes(x=Date, y=noise, color = type4), size =1.2) +
ylim(0, 1) + theme(axis.text.x=element_text(angle=30, hjust=1, size=12)) >+ theme(axis.text.y=element_text(size=12)) +
theme(legend.text=element_text(size = 15), legend.position="bottom")
但是我想为每种表示形式显示正确的符号
答案 0 :(得分:0)
ggplot(data=df) + geom_line(data=df, aes(x=Date, y=fitted_data, color= type2)) + labs(x = "Dates", y="EVI") +
geom_point(data=df, aes(x=Date, y=original_data, color = type)) +
geom_point(data=df, aes(x=Date, y=phen, color = type3), size =3) +
geom_point(data=df, aes(x=Date, y=noise, color = type4), size =1.2) +
ylim(0, 1) + theme(axis.text.x=element_text(angle=30, hjust=1, size=12)) + theme(axis.text.y=element_text(size=12)) +
theme(legend.text=element_text(size = 10), legend.position="bottom") +
theme(legend.title=element_blank()) + scale_colour_manual(values = c("red", "black", "brown", "blue"),
guide = guide_legend(override.aes = list(
linetype = c("blank", "solid", "blank", "blank"), shape = c(16, NA, 16, 16)
)))