-
Notifications
You must be signed in to change notification settings - Fork 1
/
ch-19.Rmd
87 lines (60 loc) · 1.5 KB
/
ch-19.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
---
title: "Solutions to Chapter 19 Exercises"
author: "Howard Baek"
date: "Last compiled on `r format(Sys.time(), '%B %d, %Y')`"
output: html_document
editor_options:
chunk_output_type: console
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r, include=FALSE}
library(tidyverse)
```
### 19.2.1 Exercises
1.
```{r}
pink_hist <- geom_histogram(
color = "pink",
bins = 100
)
```
2.
```{r}
fill_blues <- scale_fill_distiller(
palette = "Blues"
)
```
3.
```{r, eval=FALSE}
?theme_gray()
```
- Its arguments include `base_size`, `base_family`, `base_line_size`, and `base_rect_size`
- According to the help file, `theme_gray()` is the signature ggplot2 theme with a grey background and white gridlines and is designed to put the data forward yet make comparisons easy.
4.
```{r}
scale_colour_wesanderson <- function(palette = "BottleRocket1", ...) {
scale_color_manual(values = wesanderson::wes_palette(palette), ...)
}
# Working example
ggplot(mtcars, aes(wt, disp, color = factor(gear))) +
geom_point() +
scale_colour_wesanderson()
```
### 19.3.4 Exercises
1.
```{r}
remove_labels <- theme(legend.position = "none",
axis.title.x = element_blank(),
axis.title.y = element_blank())
# Working Example
ggplot(mtcars, aes(wt, disp, color = factor(gear))) +
geom_point() +
remove_labels
```
2. Not sure
### 19.4.3. Exercises
These questions are way above my head!
### 19.5.1 Exercises
These questions are way above my head!