Description Usage Arguments Details Value Examples
This helper can be used to arrange plots with layout
on multiple pages. Unused positions on the grid are indexed with NA
.
1 | arrange_on_page(items = NULL, byrow = TRUE)
|
items |
A list of items to arrange. |
byrow |
Whether to fill rows or columns first per page. |
As a side-effect of calling this function, the layout
of the current device is set to a matrix of nrow
x ncol
.
An integer vector of indices that can be used to sort items
so that they
are neatly placed on a single page or multiple pages with nrow
x ncol
places. The index is filled with NA
on the last page.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | op <- graphics::par(no.readonly = TRUE) # reconstitute par(...) afterwards
par(mfcol = c(4, 2), mar = rep(0, 4))
graphics::layout.show(9) # one single plot on page 2
plot_me <- function(n) {
for (i in n) {
plot.new()
text(0.5, 0.5, i)
}
}
plot_me(seq(1, 3)) # appended on same page
par(mfcol = c(4, 2), mar = rep(0, 4)) # starts new page, but not always "accessible"
plot_me(arrange_on_page(seq(1, 9), byrow = FALSE))
plot_me(LETTERS[arrange_on_page(seq(1, 2), byrow = TRUE)])
rm(plot_me)
par(op)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.