我想将原位值(线)的时间序列与特殊日期的估计值的箱线图结合起来。我试图理解这个“将不同结果的行添加到ggplot2中的boxplot图中”的问题,但是我的约会使我发疯。有时我只有日期的原位值,有时只有估计值,有时两者都在一起。
我在这里上传了我的数据样本:
http://www.file-upload.net/download-9942494/estimated.txt.html
http://www.file-upload.net/download-9942495/insitu.txt.html
到底如何使用两个数据集创建一个图,该图看起来像http://www.file-upload.net/download-9942496/desired_outputplot.png.html?
我得到了帮助,现在有一个解决方案:
insitu <- read.table("insitu.txt",header=TRUE,colClasses=c("Date","numeric"))
est <- read.table("estimated.txt",header=TRUE,colClasses=c("Date","numeric"))
insitu.plot <- xyplot(insitu~date_fname,data=insitu,type="l",
panel=function(x,y,...){panel.grid(); panel.xyplot(x,y,...)},xlab=list(label="Date",cex=2))
est.plot <- xyplot(estimated~date,data=est,panel=panel.bwplot,horizontal=FALSE)
both <- insitu.plot+est.plot
update(both,xlim=range(c(est$date,insitu$date_fname))+c(-1,1),ylim=range(c(est$estimated,insitu$insitu)))
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句