【发布时间】:2010-12-27 06:21:53
【问题描述】:
在一个通用图上,时间在 x 轴上,我想突出显示一些特定年份的时期。
我怎样才能最好地做到这一点?例如,我的想法是在情节后面为突出显示的年份添加一个浅黄色条。
我现在的剧情代码:
pdf("temperature_imfs_big_interm5.pdf", width=6, height=8);
par(mfrow=c(temperature$bigEmdIm5$nimf+1,1), mar=c(2,1,2,1))
for(i in 1:temperature$bigEmdIm5$nimf) {
plot(timeline$big, temperature$bigEmdIm5$imf[,i], type="l", xlab="", ylab="", ylim=range(temperature$bigEmdIm5$imf[,i]), axes=FALSE, main=paste(i, "-th IMF", sep=""))#; abline(h=0)
axis.POSIXct(side=1, at=tickpos$big)
}
plot(timeline$big, temperature$bigEmdIm5$residue, xlab="", ylab="", axes=FALSE, main="residue", type="l")
axis.POSIXct(side=1, at=tickpos$big)
dev.off();
其中 temperature$bigEmdIm5 是经验模式分解的输出。数据以月为单位,因此我想突出显示 01/1950 到 12/1950 之间的时间。
【问题讨论】:
-
你能把数据放在某个地方,或者添加一个命令来创建一个模拟 data.frame 以便我们可以真正帮助你吗?
-
另外,如果您的 x 轴数据属于 POSIXct 类,那么调用 'axis(side=1,at=tickpos)' 应该可以,并且比显式强制调度更好。跨度>
-
rcs:嗯,也许我被太多
zoo和xts宠坏了。即使您使用Date而不是更高分辨率,它是否也会失败。POSIXct?无论如何,感谢您的提醒! -
@Dirk: 是的,当使用
Date时也是数值