Lecture 11
Duke University
STA 313 - Spring 2023
Presentations tomorrow in lab:
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 each lab section. Let me know if this presents a big issue for getting to your next class.
Guest lecture on Thursday – make sure to complete the reading before class
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 next week
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.
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!
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
Visualize the data at [url] using ggplot2.
ae-10
https://vizdata-s23.github.io/ae-10-YOUR_GITHUB_NAME/
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")
The plot will fill the empty space in the slide.
If there is more text on the slide
The plot will shrink
To make room for the text
fig-width
For a zoomed-in look
fig-width
For a zoomed-out look
fig-width
affects text sizeFirst, 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
Insert > Slide Columns
Quarto will automatically resize your plots to fit side-by-side.
layout-ncol
Learn more at https://patchwork.data-imaginist.com.
Look into the source code at https://github.com/vizdata-s23/website/slides.