Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions arranging-plots.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ While these two scenarios are not necessarily in opposition to each other, the f
## Laying out plots side by side

Often, one wants to show two or more plots side by side to show different aspects of the same story in a compelling way.
This is the scenario that patchwork was build to solve.
This is the scenario that patchwork was built to solve.
At its heart, patchwork is a package that extends ggplot2's use of the `+` operator to work between multiple plots, as well as add additional operators for specialized compositions and working with compositions of plots.

As an example of the most basic use of patchwork, we'll use the following 4 plots of the `mpg` dataset
Expand Down Expand Up @@ -67,7 +67,7 @@ Further, you can see that the y-axis titles in the two left-most plots are align
### Taking control of the layout

It is often that the automatically created grid is not what you want and it is of course possible to control it.
The most direct and powerful way is to do this is to add a `plot_layout()` specification to the plot:
The most direct and powerful way to do this is to add a `plot_layout()` specification to the plot:

```{r}
p1 + p2 + p3 + plot_layout(ncol = 2)
Expand Down Expand Up @@ -124,7 +124,7 @@ p1 + p2 + p3 + guide_area() + plot_layout(ncol = 2, guides = "collect")

One of the tenets of patchwork is that the plots remain as standard ggplot objects until rendered.
This means that they are amenable to modification after they have been assembled.
The specific plots can by retrieved and set with `[[]]` indexing:
The specific plots can be retrieved and set with `[[]]` indexing:

```{r}
p12 <- p1 + p2
Expand Down Expand Up @@ -218,7 +218,7 @@ p1 +
)
```

insets are not confined to ggplots.
Insets are not confined to ggplots.
Any graphics supported by `wrap_elements()` can be used, including patchworks:

```{r}
Expand Down