As @plannapus commented, the function plot.modwt
already calls layout. So you will need to alter the original function.
- If you type
plot.modwt
in you R console, you will get the complete definition. - Copy this function and save it as a new function, say,
my.plot.modwt
. - Comment out the layout line in this function
Set up your new layout. This worked for me:
nf = layout(matrix(c(3, 1, 4, 2, 7, 5,8, 6), 4, 2, byrow = TRUE), c(2,2), c(2,1, 2, 1), TRUE) layout.show(nf)
Call your function (4 times )to create plots:
my.plot.modwt(modwt(dat1)) my.plot.modwt(modwt(dat2)) my.plot.modwt(modwt(dat3)) my.plot.modwt(modwt(dat4))
Note, some other alterations to the layout will probably be needed.
My code:
y.plot.modwt = function (x, levels = NULL, draw.boundary = FALSE, type = "stack",
col.plot = "black", col.boundary = "red", X.xtick.at = NULL,
X.ytick.at = NULL, Stack.xtick.at = NULL, Stack.ytick.at = NULL,
X.xlab = "t", y.rlabs = TRUE, plot.X = TRUE, plot.W = TRUE,
plot.V = TRUE, ...)
{
stackplot.modwt <- function(x, w.range, v.range, col.plot,
col.boundary, draw.boundary, X.xtick.at, X.ytick.at,
Stack.xtick.at, Stack.ytick.at, X.xlab = "t", plot.X = TRUE) {
innerplot <- function(x, y, type = "l", xtick.at, ytick.at) {
if (is.null(xtick.at) == FALSE || is.null(ytick.at) ==
FALSE) {
plot(x, y, type = "l", axes = FALSE, frame.plot = TRUE)
<snip>
if (plot.X) {
#nf <- layout(matrix(c(2, 2, 1, 1), 2, 2, byrow = TRUE),
# c(1, 2), c(2, 1), TRUE)
par(mai = c(0.6, 0.4, 0.1, 0.6))
<snip>
}