R 如何将指南添加到ggplot2?
我有以下代码:R 如何将指南添加到ggplot2?,r,ggplot2,R,Ggplot2,我有以下代码: ggplot() + stat_smooth(data=fd.area.dfa.quant,aes(x=area,y=q50),alpha=0.6,colour="Red")+ stat_smooth(data=fd.area.dfb.quant,aes(x=area,y=q50),alpha=0.6,colour="Green")+ stat_smooth(data=fd.area.cfa.quant,aes(x=area,y=q50),alpha=0.6,col
ggplot() +
stat_smooth(data=fd.area.dfa.quant,aes(x=area,y=q50),alpha=0.6,colour="Red")+
stat_smooth(data=fd.area.dfb.quant,aes(x=area,y=q50),alpha=0.6,colour="Green")+
stat_smooth(data=fd.area.cfa.quant,aes(x=area,y=q50),alpha=0.6,colour="Purple")+
stat_smooth(data=fd.area.csb.quant,aes(x=area,y=q50),alpha=0.6,colour="Blue")+
stat_smooth(data=fd.area.bsk.quant,aes(x=area,y=q50),alpha=0.6,colour="Orange")+
scale_x_log10("xlab",expand = c(0, 0),labels=comma)+
scale_y_log10("ylab", expand = c(0, 0.05),labels=comma)+
theme(aspect.ratio=1)+
ggtitle("title")+
ggsave("save2.png")
这就是数字
我想
我该怎么做呢?既然您没有共享任何示例数据以使代码成为a,我将使用我自己的,您可以修改它
d1<-data.frame(x=1:10, y=cumsum(runif(10)))
d2<-data.frame(x=1:10, y=cumsum(runif(10)))
ggplot() +
stat_smooth(data=d1,aes(x,y,colour="mya"),alpha=0.6)+
stat_smooth(data=d2,aes(x,y,colour="myb"),alpha=0.6)+
scale_color_manual(name="Line",values=c(mya="red",myb="green"))
d1融合和使用NA
即使在不同的域中也能正常工作。