forked from EvaMaeRey/tidyverse_in_action
-
Notifications
You must be signed in to change notification settings - Fork 0
/
roslings_plot.Rmd
executable file
·56 lines (39 loc) · 1.09 KB
/
roslings_plot.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
---
title: "distinct plot"
author: "Evangeline Reynolds"
date: "2/16/2019"
output: html_document
---
---
name: roslings
## Target output: *Country per capita GDP versus life expectency in 2007*
```{r roslings_plot, eval=T, echo=F, comment = " ", fig.height = preview_height}
gapminder %>%
filter(year == 2007) %>%
ggplot() +
aes(x = gdpPercap) +
aes(y = lifeExp) +
geom_point(alpha = .6) +
aes(color = continent) +
aes(size = pop / 1000000) +
labs(title = "Per capita GDP versus life expectency in 2007") +
labs(subtitle = "Data Source: Gapminder package in R") +
labs(size = "Population (millions)") +
labs(col = "") +
labs(x = "Per capita GDP") +
labs(y = "Life expectancy") +
labs(caption = "Vis: Gina Reynolds for 'Tidyverse in Action'") +
theme_minimal()
```
```{r, echo = F, message=F}
ggsave("figures/roslings_plot.png")
```
---
## How do we get there?
We are going to
- use filter() to subset the data to a single year (so the rows where the variable year is 2007).
- then we'll plot.
Let's see this in action.
---
`r apply_reveal("roslings_plot")`
---