小波中的X轴日期
我使用的是492个观测值和三个变量(日期,d,r)的每日时间序列数据。我想打印日期为01/2020,06/2020,01/2021,06/2021,01/2022,06/2022,在X-axis中,部分和交叉小波相干图。我正在使用此代码。我正在附上小波图像。 thanx 在此处输入图像描述
library (biwavelet)
library(readxl)
library (ggplot2)
data <- read_excel("C:\\Users\\Ahmed c zone\\Desktop\\12.xlsx")
t1 <- cbind(1:492, data$d)
t2 <- cbind(1:492, data$r)
nrand=10
sum (is.na(t1))
sum (is.na(t2))
t2[is.na(t2)]<-0
wtc.AB = wtc(t1,t2, nrands = brand)
par(oma=c(0,0,0,1), mar=c(5,4,5,5) + 0.1)
plot(wtc.AB, plot.phas=TRUE, xaxt='n', lty.coi=1, col.coi="black",
lwd.coi=2, lwd.sig=2,arrow.lwd=0.05, arrow.len=0.08, ylab="Scale",
xlab="Years", plot.cb=T,main="Wavelet Coherence:X vs Y")
n=length(t1 [,1])
axis(side=1, at=c(seq(0, n, 82), labels=c(seq(2020, 2022, 6))))
rm(list=ls(all=TRUE))`
请帮助。我是使用R语言的新手。
I am using daily time series data of 492 observations and three variables, (date, d, r). I want to print dates as 01/2020, 06/2020, 01/2021, 06/2021, 01/2022, 06/2022, on X-axis in partial and cross wavelet coherence plots. I am using this code. I am attaching the wavelets image. Thanx
enter image description here
library (biwavelet)
library(readxl)
library (ggplot2)
data <- read_excel("C:\\Users\\Ahmed c zone\\Desktop\\12.xlsx")
t1 <- cbind(1:492, data$d)
t2 <- cbind(1:492, data$r)
nrand=10
sum (is.na(t1))
sum (is.na(t2))
t2[is.na(t2)]<-0
wtc.AB = wtc(t1,t2, nrands = brand)
par(oma=c(0,0,0,1), mar=c(5,4,5,5) + 0.1)
plot(wtc.AB, plot.phas=TRUE, xaxt='n', lty.coi=1, col.coi="black",
lwd.coi=2, lwd.sig=2,arrow.lwd=0.05, arrow.len=0.08, ylab="Scale",
xlab="Years", plot.cb=T,main="Wavelet Coherence:X vs Y")
n=length(t1 [,1])
axis(side=1, at=c(seq(0, n, 82), labels=c(seq(2020, 2022, 6))))
rm(list=ls(all=TRUE))`
Please help. I am new in using R language.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
小波相干性不能直接用X轴上的日期绘制。但是,您可以创建日期标签并沿X轴绘制它们。为此,您需要使用
strftime
函数。我已经使用随机生成的变量来运行您的代码。这是您需要做的,这是结果
Wavelet coherence cannot be plotted directly with dates on the x-axis. However, you can create date labels and draw them along the x-axis. For this purpose, you need to use
strftime
function. I have run your code using randomly generated variables. Here's what you need to doHere's the results