View source: R/patchwork_design.R
| patchwork_design | R Documentation |
Create a non-overlapping patchwork design layout by specifying a list of block dimensions.
Motivation: When using the "design" argument of patchwork::plot_layout(), it can be cumbersome to use the syntax required by the patchwork framework. This syntax requires creating a vector of area elements, each of which is created by a call to patchwork::area(). This area function requires specifying the left/right/top/bottom coordinates of each block. This can become impractical when designing and making multiple edits to a complex layout in which we want our patches to be tiled/adjacent to one another. It can be much easier to instead specify a list of block dimensions, and have a function dynamically calculate all the necessary top/left/bottom/right coordinates. That is what this function does.
patchwork_design(..., margin.row = 0)
... |
Character vectors specifying block dimensions. Each vector corresponds to a row in the output layout. Each element of each vector is a character of the form |
margin.row |
An optional integer specifying the number of units of space to place in-between rows. |
A vector of patchwork areas.
patchwork::area(), patchwork::plot_layout()
# Create a layout with 2 blocks in the first row,
# 2 blocks in the second row, 1 block in the
# third row, and 2 blocks in the fourth row.
patchwork_design(
c("8x10", "6.5x18"),
c("9x12", "10x17"),
c("4x28"),
c("11x9", "11x13"),
margin.row = 2
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.