53 Vis: Improving Graphs
Purpose: Creating a presentation-quality graph is an iterative exercise. There are many different ways to show the same data, some of which are more effective for communication than others. Let’s return to the ideas from “How Humans See Data” and use them to improve upon some graphs: This will give you practice iterating on visuals.
Reading: How Humans See Data (Video from prior exercise, for reference)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.0 ──
## ✔ ggplot2 3.4.0 ✔ purrr 1.0.1
## ✔ tibble 3.1.8 ✔ dplyr 1.0.10
## ✔ tidyr 1.2.1 ✔ stringr 1.5.0
## ✔ readr 2.1.3 ✔ forcats 0.5.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
53.1 Improve these graphs!
Using the ideas from the reading (video), state some issues with the following graphs. Remember the visual hierarchy:
- Position along a common scale
- Position on identical but nonaligned scales
- Length
- Angle; Slope (With slope not too close to 0, \(\pi/2\), or \(\pi\).)
- Area
- Volume; Density; Color saturation
- Color hue
53.1.1 q1 Use concepts from the reading to improve the following graph. Make sure your graph shows all the same variables, no more and no fewer.
## NOTE: No need to edit; run and inspect
mpg %>%
ggplot(aes(manufacturer, cty)) +
geom_boxplot() +
coord_flip()
Create your improved graph here
53.1.2 q2 Use concepts from the reading to improve the following graph. Make sure your graph shows all the same variables, no more and no fewer.
## NOTE: No need to edit; run and inspect
as_tibble(mtcars) %>%
mutate(model = rownames(mtcars)) %>%
ggplot(aes(x = "", y = "", size = mpg)) +
geom_point() +
facet_wrap(~model)
Create your improved graph here
53.1.3 q3 Use concepts from the reading to improve the following graph. Make sure your graph shows all the same variables, no more and no fewer.
## NOTE: No need to edit; run and inspect
diamonds %>%
ggplot(aes(clarity, fill = cut)) +
geom_bar()
Create your improved graph here
53.1.4 q4 Use concepts from the reading to improve the following graph. Make sure your graph shows all the same variables, no more and no fewer.
## NOTE: No need to edit; run and inspect
diamonds %>%
ggplot(aes(x = "", fill = cut)) +
geom_bar() +
coord_polar("y") +
labs(x = "")
Create your improved graph here