Presentation ready plots

Lecture 11

Dr. Greg Chism

University of Arizona
INFO 526 - Spring 2024

Warm up

Announcements I

Presentations Monday Mar 11 in lecture:

  • Bring a laptop to fill out feedback forms

  • One more team evaluation to be filled out promptly after class

  • Presentation order to be announced in class tomorrow

We might go over by 10 mins max for lecture.

Announcements II

  • Take note of Project 2 presentation date: must be in class in person to present or present live via Zoom in case of isolation

  • New teams to be announced following presentations

Lessons from HW 02

  • Read the question carefully

    • Several instances of no written narrative

    • Narrative means interpreting the trends from the plot

  • Colors are important

    • Contextual colors (e.g., political party colors) should be adhered to
  • Narrative format

    • Narrative text needs to be plain text, with a ## or ### level “Narrative” header above
  • Suppress warnings and messages

    • Use #| warning: false and #| message: false
  • GitHub commits are important

    • You must use at least one commit for each question, otherwise you won’t be able to revert to prior commits.

Setup

# load packages
library(countdown)
library(tidyverse)
library(ggrepel)
library(patchwork)
library(ggtext)

# set theme for ggplot2
ggplot2::theme_set(ggplot2::theme_minimal(base_size = 16))

# set figure parameters for knitr
knitr::opts_chunk$set(
  fig.width = 7, # 7" width
  fig.asp = 0.618, # the golden ratio
  fig.retina = 3, # dpi multiplier for displaying HTML output on retina
  fig.align = "center", # center align figures
  dpi = 300 # higher dpi, sharper image
)

Telling a story

Multiple ways of telling a story

  • Sequential plots: Motivation, then resolution

  • A single plot: Resolution, and hidden in it motivation

Project note: you’re asked to create two plots per question. One possible approach: Start with a plot showing the raw data, and show derived quantities (e.g. percent increases, averages, coefficients of fitted models) in the subsequent plot.

Simplicity vs. complexity

When you’re trying to show too much data at once you may end up not showing anything.

  • Never assume your audience can rapidly process complex visual displays

  • Don’t add variables to your plot that are tangential to your story

  • Don’t jump straight to a highly complex figure; first show an easily digestible subset (e.g., show one facet first)

  • Aim for memorable, but clear

Project note: Make sure to leave time to iterate on your plots after you practice your presentation. If certain plots are getting too wordy to explain, take time to simplify them!

Consistency vs. repetitiveness

Be consistent but don’t be repetitive.

  • Use consistent features throughout plots (e.g., same color represents same level on all plots)

  • Aim to use a different type of visualization for each distinct analysis

Project note: If possible, ask a friend who is not in the class to listen to your presentation and then ask them what they remember. Then, ask yourself: is that what you wanted them to remember?

Designing effective visualizations

Keep it simple

Judging relative area

From Data to Viz caveat collection - The issue with pie chart

Use color to draw attention



Tell a story

Leave out non-story details

Order matters

Credit: Angela Zoss and Eric Monson, Duke DVS

Clearly indicate missing data

http://ivi.sagepub.com/content/10/4/271

Reduce cognitive load

http://www.storytellingwithdata.com/2012/09/some-finer-points-of-data-visualization.html

Use descriptive titles

Credit: Angela Zoss and Eric Monson, Duke DVS

Annotate figures

https://bl.ocks.org/susielu/23dc3082669ee026c552b85081d90976

Plot layout

Sample plots

p_hist <- ggplot(mtcars, aes(x = mpg)) +
  geom_histogram(binwidth = 2)
p_box <- ggplot(mtcars, aes(x = factor(vs), y = mpg)) +
  geom_boxplot()
p_scatter <- ggplot(mtcars, aes(x = disp, y = mpg)) +
  geom_point()
p_text <- mtcars |>
  rownames_to_column() |>
  ggplot(aes(x = disp, y = mpg)) +
  geom_text_repel(aes(label = rowname)) +
  coord_cartesian(clip = "off")

Slide with single plot, little text

The plot will fill the empty space in the slide.

p_hist

Slide with single plot, lots of text

  • If there is more text on the slide

  • The plot will shrink

  • To make room for the text

p_hist

Small fig-width

For a zoomed-in look

```{r}
#| fig-width: 3
#| fig-asp: 0.618

p_hist
```

Large fig-width

For a zoomed-out look

```{r}
#| fig-width: 10
#| fig-asp: 0.618

p_hist
```

fig-width affects text size

Multiple plots on a slide

First, ask yourself, must you include multiple plots on a slide? For example, is your narrative about comparing results from two plots?

  • If no, then don’t! Move the second plot to to the next slide!

  • If yes,

    • Insert columns using the Insert anything tool

    • Use layout-ncol chunk option

    • Use the patchwork package

    • Possibly, use pivoting to reshape your data and then use facets

Columns

Insert > Slide Columns

Quarto will automatically resize your plots to fit side-by-side.

layout-ncol

```{r}
#| fig-width: 5
#| fig-asp: 0.618
#| layout-ncol: 2

p_hist
p_scatter
```

patchwork

```{r}
#| fig-width: 7
#| fig-asp: 0.4

p_hist + p_scatter
```

patchwork layout I

(p_hist + p_box) /
  (p_scatter + p_text)

patchwork layout II

p_text / (p_hist + p_box + p_scatter)

patchwork layout III

p_text + p_hist + p_box + p_scatter + 
  plot_annotation(title = "mtcars", tag_levels = c("A"))

patchwork layout IV

p_text + {
  p_hist + {
    p_box + p_scatter + plot_layout(ncol = 1) + plot_layout(tag_level = 'new')
  }
} + 
  plot_layout(ncol = 1) +
  plot_annotation(tag_levels = c("1","a"), tag_prefix = "Fig ")

More patchwork


Learn more at https://patchwork.data-imaginist.com.

Want to replicate something you saw in my slides?


Look into the source code at https://github.com/INFO-526-S24/INFO526-S24/slides/.

🔗 datavizaz.org

1 / 38
Presentation ready plots Lecture 11 Dr. Greg Chism University of Arizona INFO 526 - Spring 2024

  1. Slides

  2. Tools

  3. Close
  • Presentation ready plots
  • Warm up
  • Announcements I
  • Announcements II
  • Lessons from HW 02
  • Setup
  • Telling a story
  • Multiple ways of telling a story
  • Simplicity vs. complexity
  • Consistency vs. repetitiveness
  • Designing effective visualizations
  • Keep it simple
  • Judging relative area
  • Use color to draw attention
  • Tell a story
  • Leave out non-story details
  • Order matters
  • Clearly indicate missing data
  • Reduce cognitive load
  • Use descriptive titles
  • Annotate figures
  • Plot layout
  • Sample plots
  • Slide with single plot, little text
  • Slide with single plot, lots of text
  • Small fig-width
  • Large fig-width
  • fig-width affects text size
  • Multiple plots on a slide
  • Columns
  • layout-ncol
  • patchwork
  • patchwork layout I
  • patchwork layout II
  • patchwork layout III
  • patchwork layout IV
  • More patchwork
  • Want to replicate something you saw in my slides?
  • f Fullscreen
  • s Speaker View
  • o Slide Overview
  • e PDF Export Mode
  • b Toggle Chalkboard
  • c Toggle Notes Canvas
  • d Download Drawings
  • ? Keyboard Help