Choosing a visual and themes

Dr. Nathaniel Cline

Agenda

1

Project Topic, Audience, and Data

2

Choosing a Visual

3

Themes in ggplot

Project topics, audience, and data

Choosing a visual

How do we choose?

  • We have talked about visualizations of data in lots of contexts

  • But if you are past the exploratory phase, and now trying to communicate to an audience, what are the merits of using one visualization over another?

  • Your reading covered the main types of visualizations we see in the wild

Core types of visualizations

  • Simple text

  • Table

  • Heat map

  • Scatter plot

  • Line

  • Slope graph

  • Bar charts

    • vertical, horizontal, stacked, 100% stacked
  • Waterfall

  • Waffle chart

  • And more!

20%

of children had a

traditional stay-at-home mom

in 2012, compared to 41% in 1970

When you have just a number or two to communicate - text might be the right way!

Tables

  • Tables are meant to be read

    • not great for presentations
  • Tables make it easy to look up individual values, or pairs of values

    • harder to see patterns
  • As a general rule, light and minimal borders are better

Heatmaps

Color helps reduce mental processing requirements. Generally we map high - low to dark-light.

Scatterplots

  • scatter plots obviously good for showing relation between two variables.

Line graphs

  • best for time series

Slope graphs

Bar charts

  • good for categorical data

  • Usually we want to kep Y-axis at zero (not necessarily true for lines!)

  • class vertical is good for just a couple data series

  • Stacked vertical can be hard to judge - put key variable on bottom

  • horizontal good for long category names, direct eyes to names first

Waffle

  • Author claims this is good for significantly different magnitudes

Critique

Assume you work at Financial Savings. QUESTION 1: What questions do you have about this data? QUESTION 2: If you were designing the graph, what changes would you make? How would you visualize this data?

Practice

Use the handouts for today to practice choosing the right visual.

Themes in ggplot

Themes

  • The theme function is magic!

  • The graphs on the following slides were all made using essentially the same base graph with different themes applied

Minimal

Code
satgpa <- satgpa

ggplot(satgpa, aes(x = sat_sum, y = fy_gpa)) +
  geom_point(color = "#B22222") +
  labs(title = "Do SAT Scores predict First-Year GPA?",
       x = "SAT Score",
       y = "First-Year GPA")+ 
  theme_minimal()

Economist

Code
ggplot(satgpa, aes(x = sat_sum, y = fy_gpa)) +
  geom_point(color = "#B22222") +
  labs(title = "Do SAT Scores predict First-Year GPA?",
       x = "SAT Score",
       y = "First-Year GPA")+
  theme_economist()

Five Thirty Eight

Code
ggplot(satgpa, aes(x = sat_sum, y = fy_gpa)) +
  geom_point(color = "#B22222") +
  labs(title = "Do SAT Scores predict First-Year GPA?",
       x = "SAT Score",
       y = "First-Year GPA")+ 
  theme_fivethirtyeight()

WSJ

Code
ggplot(satgpa, aes(x = sat_sum, y = fy_gpa)) +
  geom_point(color = "#B22222") +
  labs(title = "Do SAT Scores predict First-Year GPA?",
       x = "SAT Score",
       y = "First-Year GPA")+
  theme_wsj()

HRBR FT

Code
ggplot(satgpa, aes(x = sat_sum, y = fy_gpa)) +
  geom_point(color = ft_cols$yellow)+ labs(title = "Do SAT Scores predict First-Year GPA?",
       x = "SAT Score",
       y = "First-Year GPA")+  theme_ft_rc()

HRBR Ipsum

Code
ggplot(satgpa, aes(x = sat_sum, y = fy_gpa)) +
  geom_point()+ labs(title = "Do SAT Scores predict First-Year GPA?",
       x = "SAT Score",
       y = "First-Year GPA")+  theme_ipsum()

BBC

Code
ggplot(satgpa, aes(x = sat_sum, y = fy_gpa)) +
  geom_point(color = "#B22222") +
  labs(title = "Do SAT Scores predict First-Year GPA?",
       x = "SAT Score",
       y = "First-Year GPA")+
  bbc_style()

Barbie

Code
ggplot(satgpa, aes(x = sat_sum, y = fy_gpa)) +
  geom_point(color = "#d74ea2ff")+ labs(title = "Do SAT Scores predict First-Year GPA?",
       x = "SAT Score",
       y = "First-Year GPA")+  theme_barbie()

Game of Thrones

Code
ggplot(satgpa, aes(x = sat_sum, y = fy_gpa)) +
  geom_point(color = "#8C4522")+ labs(title = "Do SAT Scores predict First-Year GPA?",
       x = "SAT Score",
       y = "First-Year GPA")+  theme_gameofthrones()

Theme elements

In addition to applying pre-set themes, the theme function can also alter most of the elements of your graph outside of plot type and aes assignment.

To-do

For next time

  • Read “Reducing Clutter”
  • Complete the “themes” assignment in Rstudio cloud

Econ 255 - Data Storytelling

1 / 31
Choosing a visual and themes Dr. Nathaniel Cline

  1. Slides

  2. Tools

  3. Close
  • Choosing a visual and themes
  • Agenda
  • Project topics, audience, and data
  • Choosing a visual
  • How do we choose?
  • Core types of visualizations
  • 20% of children had...
  • Tables
  • Heatmaps
  • Scatterplots
  • Line graphs
  • Slope graphs
  • Bar charts
  • Waffle
  • Critique
  • Practice
  • Themes in ggplot
  • Themes
  • Minimal
  • Economist
  • Five Thirty Eight
  • WSJ
  • HRBR FT
  • HRBR Ipsum
  • BBC
  • Barbie
  • Game of Thrones
  • Theme elements
  • Slide 29
  • To-do
  • For next time
  • f Fullscreen
  • s Speaker View
  • o Slide Overview
  • e PDF Export Mode
  • b Toggle Chalkboard
  • c Toggle Notes Canvas
  • d Download Drawings
  • ? Keyboard Help