SMAC-Group / wv

:alarm_clock: This R package provides the tools to perform standard and robust wavelet variance analysis for time series (signal processing). Among others, aside from computing the wavelet variance and cross-covariance (classic and robust), the package provides inference tools (e.g. confidence intervals) and plotting tools allowing to perform some visual analysis and assess the properties of the underlying time series.
https://smac-group.github.io/wv/
15 stars 10 forks source link

Names handover to legend in compare_wvar wrongly #15

Open stefangachter opened 2 years ago

stefangachter commented 2 years ago

Dear all, If I specify names list for legend, then compare_wvar throws an error:

compare_wvar(wv_Xt, wv_Yt, wv_Zt, names=list('Xt','Yt','Zt'))
Error in as.graphicsAnnot(legend) : 
  argument "legend" is missing, with no default

Full example, see below, I think that the bug is that name argument legend = should be added:

  if (graph_details$add_legend){
    legend(graph_details$legend_position, legend = graph_details$names, bty = "n",
           lwd = 1, pt.cex = graph_details$point_cex, pch = graph_details$point_pch,
           col = graph_details$col_wv)
  }

The full example:

n = 2.5*10^5
model = WN(sigma2 = 1) + AR(phi = 0.999, sigma2 = 10^(-5))
Xt = gen_gts(n = n, model = model)
wv_Xt = wvar(Xt)
model = WN(sigma2 = 1.03) + AR(phi = 0.9995, sigma2 = 0.5*10^(-5))
Yt = gen_gts(n = 4*n, model = model)
wv_Yt = wvar(Yt)
model = WN(sigma2 = 0.98) + AR(phi = 0.999, sigma2 = 10^(-5))
Zt = gen_gts(n = 2*n, model = model)
wv_Zt = wvar(Zt)
compare_wvar(wv_Xt, wv_Yt, wv_Zt, names=list('Xt','Yt','Zt'))