my.date <- seq(as.POSIXct("2014-10-14 00:00:00", format="%F %T"),
by="hour",
length.out=6*128*24)
library('WaveletComp')
x <- periodic.series(start.period=1*24, length=6*128*24)
my.data <- data.frame(date=my.date, x=x)
my.wt <- analyze.wavelet(my.data, "x",
loess.span=0,
dt=1/24, dj=1/20,
lowerPeriod=1/4,
make.pval=TRUE, n.sim=10)
layaout2 <- layout(matrix(c(1, 2, 3), nrow=3))
wt.image(my.wt, main="wavelet power spectrum",
legend.params=list(lab="wavelet power levels (quantiles)",
lab.line=3.5,
label.digits=2),
periodlab="period (days)")
p1 <- recordPlot()
wt.image(my.wt, main="wavelet power spectrum",
legend.params=list(lab="wavelet power levels (quantiles)",
lab.line=3.5,
label.digits=2),
periodlab="period (days)")
p2 <- recordPlot()
plot_grid(p1, p2,
labels='AUTO',
hjust=0, vjust=1)
I got error
Error in if (labels) { : missing value where TRUE / FALSE is required

Apparently you can't place
"recordedplot"objects on alayout.Not sure why you want use
grDevices::recordPlotat all, maybe you want to mimick some sort of ggplot behavior. However, baseplot, orWaveletComp::wt.imagewhich uses it, will always complete plotting, so you would always see your plots twice.So you may stick with
layoutor usepar(mfrow=)as in @robert-hacken's answer, and setgraphics.reset=FALSEaccording to his advice.I recommend using the
pngdevice rather than RStudio preview window; it's much faster and produces hard-coded image size. Plot is stored in working directory (or usepng('/<path>/foo.R')). If you don't want use it, just comment outpnganddev.offline:Note: Don't use
layouttogether w/par(mfrow=, mfcol=)options, as they are not compatible.Update
To combine multiple analyses in a plot, store first analyses in a
list, then loop over the list to plot. Example:Maploops over elements synchronously, i.e. if there's just one as indt=1/24it will always use1/24, if there's multiple as inmy.data=list(my.data1, my.data2, my.data3), orloess.span=c(0, .25, .5), it will use the elements one by one. Note, that a list or data.frame itself is a list w/ multiple elements, and you'd need to list it again, e.g.my.data=list(my.data1)instead of justmy.data=my.data1.