## Not run:
# ## The following example is adopted from Liu et al, 2007:
#
# series.length = 6*128*24
# x1 = periodic.series(start.period = 1*24, length = series.length)
# x2 = periodic.series(start.period = 8*24, length = series.length)
# x3 = periodic.series(start.period = 32*24, length = series.length)
# x4 = periodic.series(start.period = 128*24, length = series.length)
# x = x1 + x2 + x3 + x4
#
# plot(ts(x, start=0, frequency=24), type="l",
# xlab="time (days)", ylab="hourly data",
# main="a series of hourly data with periods of 1, 8, 32, and 128 days")
#
# my.date = seq(as.POSIXct("2014-10-14 00:00:00","%F %T"), by="hour",
# length.out=series.length)
# my.data = data.frame(date=my.date, x=x)
#
# my.w = analyze.wavelet(my.data, "x",
# loess.span=0,
# dt=1/24, dj=1/20,
# lowerPeriod=1/4,
# make.pval=T, n.sim=10)
#
# ## Plot of wavelet power spectrum with breakpoints referring to quantiles:
# wt.image(my.w,
# legend.params=list(lab="wavelet power levels (quantiles)", lab.line=3.5,
# label.digits=2))
#
# ## The same plot, but with equidistant color breakpoints:
# wt.image(my.w, color.key="i",
# legend.params=list(lab="wavelet power levels (equidistant levels)"))
#
# ## The plot with calendar axis:
# wt.image(my.w, color.key="i",
# legend.params=list(lab="wavelet power levels (equidistant levels)"),
# show.date=T, date.format="%F %T", timelab="")
#
# ## The same plot, but now with individualized calendar axis:
# my.plot = wt.image(my.w, color.key="i",
# legend.params=list(lab="wavelet power levels (equidistant levels)"),
# label.time.axis=F)
# ## recover plot region:
# par(new=T, plt=my.plot$image.plt)
# ## empty plot
# plot(my.date, rep(1,series.length), type="n",
# xaxs = "i", yaxs="i", xaxt="n", yaxt="n",
# xlab="", ylab="")
# ## individualized calendar axis:
# axis.POSIXct(1, at=
# seq(as.POSIXct("2014-11-01 00:00:00", "%F %T"), my.date[length(my.date)], by="month"),
# format="%b %Y", las=2)
# ## return to default plot region:
# par(my.plot$op)
#
# ## A plot with different colors:
# wt.image(my.w,
# legend.params=list(lab="wavelet power levels (quantiles)", lab.line=3.5,
# label.digits=2),
# color.palette="gray((1:n.levels)/n.levels)", col.ridge="yellow")
#
# ## End(Not run)
Run the code above in your browser using DataLab