How To Plot With Patchwork: Exercises
The goal of patchwork is to make it simple to combine separate ggplots into the same graphic. It tries to solve the same problem as gridExtra::grid.arrange() and cowplot::plot_grid, but using an API that incites exploration and iteration.
Before proceeding, please follow our short tutorial.
Look at the examples given and try to understand the logic behind them. Then, try to solve the exercises below by using R without looking at the answers. Then, check the solutions to check your answers.
Create a scatter-plot object of
Create a box-plot object of
disp grouped by
Compose those two objects into one graph.
Repeat the previous process but in one plotting operation.
Display the composed graph in one column with the two graphs, one below the other.
Set the graph on top to have two times the size of the graph at the bottom.
Add space between your plots.
Create two objects of your choice (
p4) and display all of your four objects in nested mode by putting
p4 on top
p3 at the bottom (nested one below the other.)
Now, put the two nested plots next to each other.
p4 in one column and the rest of your objects in another.