Put all required libraries into this chunk.
```{r setup}
```
## References
* [ggplot2 reference page](https://ggplot2.tidyverse.org/)
* [cheatsheet](https://github.com/rstudio/cheatsheets/raw/master/data-visualization-2.1.pdf) when you are doing the exercises.
## Exercise 1.
Visualize relationship between car efficiency in the city cycle (`cty`), engine displacement (`displ`), and drive train type (`drv`) using color points. Think about which variables are mapped on each axes and which is best depicted as color.
```{r exercise 01}
```
## Exercise 2.
Reuse code from previous exercise and add [geom_smooth](https://ggplot2.tidyverse.org/reference/geom_smooth.html).
```{r exercise 02-1}
```
Now remove standard error stripes, see manual on this.
```{r exercise 02-2}
```
Next, use linear regression instead of the default (loess) algorithm.
```{r exercise 02-3}
```
## Exercise 3. Including cylinder count
Including number of cylinders by mapping it on the _size_ of geometry.
```{r exercise 03}
```
## Exercise 4. Splitting subplots by year
Visually separate data into a subplot by year via [facet_wrap](https://ggplot2.tidyverse.org/reference/facet_wrap.html) function.
```{r exercise 04}
```
## Exercise 5. Logarithmic scale
Use logarithmic scale for y-axis.
```{r exercise 05}
```
## Exercise 6. Prettify
Use more meaningful axes labels (`xlab()`, `ylab()` functions) and add a plot title (`labs`). see [reference](https://ggplot2.tidyverse.org/reference/labs.html).
```{r exercise 06}
```
## Exercise 7. Highway cycle as a function of drive train
Plot relationship between the drive train (`drv`) and highway cycle efficiency (`hwy`). Use point as visuals.
```{r exercise 07}
```
## Exercise 8. Box and violin plots
Use previous code but replace points with box or violin plots (try both).
```{r exercise 08-1}
```
```{r exercise 08-2}
```
## Exercise 9. Grid of subplots
Use [facet_grid](https://ggplot2.tidyverse.org/reference/facet_grid.html) for generate subplot per year and number of cylinders.
```{r exercise 09}
```
## Exercise 10. Labels and title
Improve previous plot by adding better axes labels and title
```{r exercise 10}
```
## Exercise 11. Histogram of the total sleep
Plot the distribution of total mammal sleep using a histogram.
```{r exercise 11}
```
## Exercise 12. Smooth density estimate
Replace histogram with smooth density estimates
```{r exercise 12}
```
## Exercise 13. Histogram per vore kind
Use histograms and map fill color onto `vore` variable
```{r exercise 13}
```
## Exercise 14. Histogram per row
Use `facet_grid` to plot one histogram per row.
```{r exercise 14}
```
## Exercise 15. Identity
Use `position` argument to disentangle histograms.
```{r exercise 15}
```
## Exercise 16.
Reuse your code from exercise #6 (last exercise on city cycle versus engine displacement). Try setting `alpha` first for _all_ visuals and, then, for one or some visuals.
```{r exercise 16-1}
```
```{r exercise 16-2}
```
## Exercise 17
Reuse your code from last exercise but experiment in setting constant `size` of the points.
```{r exercise 17-1}
```
Set different constant size for dots and regression lines.
```{r exercise 17-2}
```
Make dot size depend on `cyl` variable but set regression lines to the constant size.
```{r exercise 17-3}
```
## Exercise 18
Make a plot even prettier by using themes. Decide on which plot you want to work with.
```{r exercise 18}
```