- if (layout > 1)
- layout(matrix(1:layout, ceiling(sqrt(layout)), byrow = TRUE))
- else layout(matrix(1))
- if (!par("ask")) {
- par(ask = TRUE)
- on.exit(par(ask = FALSE))
+ layout(matrix(1:layout, ceiling(sqrt(layout)), byrow = TRUE))
+ if (!devAskNewPage() && interactive()) {
+ devAskNewPage(TRUE)
+ on.exit(devAskNewPage(FALSE))