我正在尝试创建一个在一个图中包含多个geom_smooth趋势线的图。我当前的代码如下:
png(filename="D:/Users/...",width = 10,height = 8,units = 'in',res = 300)
ggplot(Data) +
geom_smooth(aes(BA,BAgp1),colour="red",fill="red") +
geom_smooth(aes(BA,BAgp2),colour="turquoise",fill="turquoise") +
geom_smooth(aes(BA,BAgp3),colour="orange",fill="orange") +
xlab(bquote('Tree Basal Area ('~cm^2~')')) +
ylab(bquote('Predicted Basal Area Growth ('~cm^2~')')) +
labs(title = expression(paste("Other Softwoods")),subtitle = "Tree Level Basal Area Growth") +
theme_bw()
dev.off()
这将产生以下情节:
问题是我无法为自己提供一个简单的图例,可以在其中标注每个趋势线所代表的含义。数据集非常大-如果它对于确定我将在外部发布到Stackoverflow的解决方案很有用。