双小波包:"axis" 不工作

biwavelet package: "axis" is not working

我正在使用 biwavelet 包进行小波相干分析。当我想设置自己的 x ticklabel 时,我发现 axis 不起作用。下面给出了一个可重现的例子。谢谢

require(biwavelet)
t1 <- cbind(1:100, rnorm(100))
t2 <- cbind(1:100, rnorm(100))
wtc.t1t2 <- wtc(t1,t2,nrands = 10) 
plot(wtc.t1t2, plot.cb = TRUE, plot.phase = TRUE,xaxt='n')
axis(1,at = seq(10,100,10),labels = seq(1,10,1))

破坏你的阴谋的是plot.cb = TRUE

plot.biwavelet 的源代码中,作者对 plot.cb 选项做了以下说明:

## Add color bar: this must happen after everything, otherwise chaos ensues!

这就是问题所在——您在 plot.cb 之后调用了 axis(),随后出现了混乱。 但是,您可以使用 fields 包中的 image.plot 手动添加颜色条,在 运行 plot 没有 plot.cb 然后添加了你的 axis().

pacman::p_load(biwavelet,fields)
t1 <- cbind(1:100, rnorm(100))
t2 <- cbind(1:100, rnorm(100))
wtc.t1t2 <- wtc(t1,t2,nrands = 10) 
plot(wtc.t1t2, plot.phase = TRUE,xaxt='n')
axis(1,at = seq(10,100,10),labels = seq(1,20,2))
image.plot( zlim=c(0,25), legend.only=TRUE)

您可以按照自己的喜好自定义刻度和颜色条!