**INTRODUCTION**

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.

**Exercise 1**

Create a scatter-plot object of `mtcars`

between `mpg`

and `disp`

.

**Exercise 2**

Create a box-plot object of `mtcars`

between `gear`

and `disp`

grouped by `gear`

.

**Exercise 3**

Compose those two objects into one graph.

**Exercise 4**

Repeat the previous process but in one plotting operation.

**Exercise 5**

Display the composed graph in one column with the two graphs, one below the other.

**Exercise 6**

Set the graph on top to have two times the size of the graph at the bottom.

**Exercise 7**

Add space between your plots.

**Exercise 8**

Create two objects of your choice (`p3`

,` p4`

) and display all of your four objects in nested mode by putting `p4`

on top` p1`

and `p2`

and `p3`

at the bottom (nested one below the other.)

**Exercise 9**

Now, put the two nested plots next to each other.

**Exercise 10**

Finally, display `p4`

in one column and the rest of your objects in another.

**What's next:**

- Explore all our (>1000) R exercises
- Find an R course using our R Course Finder directory
- Subscribe to receive weekly updates and bonus sets by email
- Share with your friends and colleagues using the buttons below

## Leave a Reply