我一直试图在堆积条形图/面积图的组合上重新创建这篇文章。不过,我有一些缺失值的问题。
这是我的数据:https ://www.dropbox.com/sh/pnkspwnn1qslm6u/JapTKCwqMS
我跑的是;
wa=read.table('wa_class.txt', sep="", header=F, na.string="0")
names(wa)=c("Class","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
wam=melt(wa)
wam$variablen=as.numeric(wam$variable)
它看起来如何
> head(wam)
Class variable value variablen
1 Actinobacteria Jan 38.115163 1
2 Flavobacteria Jan NA 1
3 Sphingobacteria Jan 3.640469 1
4 Alphaproteobacteria Jan 13.631663 1
5 Betaproteobacteria_b28 Jan 3.718671 1
6 Betaproteobacteria Jan 14.732354 1
ggplot(na.omit(wam[,c("Class","value","variablen")]), aes(wam,x=variablen, y=value, fill=Class)) + geom_area(color="black") + geom_linerange(aes(ymax=value), position="stack") + scale_x_continuous(breaks=1:max(wam$variablen)) + labs(title="Water", x="Month", y="Relative abundance (%)")
...所以我尝试在我绘制的变量上使用 na.omit 来纠正缺失值。但是,我在图中得到了例如相互覆盖的图层(请参阅保管箱文件夹)。
我找到了这篇文章(见保管箱文件夹),它纠正了它,但似乎只有一个。而且我无法重现它,因为指向数据的链接已经失效。
任何帮助将不胜感激!
谢谢,
乔