-
Notifications
You must be signed in to change notification settings - Fork 0
/
Chapter_28.Rmd
52 lines (40 loc) · 1.08 KB
/
Chapter_28.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
---
title: "Chapter 28"
author: "Laura"
date: "7/20/2019"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Notes for Chapter 28: Graphics for communication
Cool extra read The truthful art by Alberto Cairo - does not seem to have an open version :_(
Come to this chapter if you need details on how to tweak your plot for nice reporting. Including details about:
* Labelling
* Annotations
* Changing and harmonizing scales
* Zooming
* All-things themes and more
* Tips for sizing your plots withing Rmarkdown and also a bit about ggsave
```{r}
df <- tibble(
x = runif(10),
y = runif(10),
z = as.factor(rpois(10, 2))
)
ggplot(df, aes(x, y, size = z)) +
geom_point() +
labs(
x = quote(sum(x[i] ^ 2, i == 1, n)),
y = quote(alpha + beta + frac(delta, theta)),
size = "Prueba"
)
```
```{r}
presidential %>%
mutate(id = 33 + row_number()) %>%
ggplot(aes(start, id, colour = party)) +
geom_point() +
geom_segment(aes(xend = end, yend = id)) +
scale_colour_manual(values = c(Republican = "red", Democratic = "blue"))
```