01:00
Beyond Basic ggplot2
Moving from “making plots” to “effective communication”:
By the end of this session, you will:
Focus: Comprehensive resources to teach professional data visualization
Teaching visualization requires evaluating:
Goal: Students learn to self-assess, iterate, and improve
Technical Accuracy:
Design Principles:
Communication:
⁇ After considering some of the principles of “good” viz, what features should we be grading for?
⁇ What message do we want to tell by the rubric?
Take just 60 seconds to consider what elements would go into the rubric.
01:00
Criteria | Excellent (4) | Good (3) | Needs Work (2) | Poor (1) |
---|---|---|---|---|
Chart Type | Match for data & message | Appropriate choice | Questionable fit | Wrong choice |
Design | Polished, clean, accessible | Good design principles | Some issues | Many problems |
Message | Compelling insight | Good communication | Unclear message | No clear point |
Process | Shows iteration/ reflection | Evidence of thinking | Some documentation | No process shown |
Teaching Tip: Have students grade example visualizations using your rubric before using it on their own work
Challenge students to create a data visual that does well in only one of the 4 criteria
Rubric Examples:
Design Principle Resources:
Teaching Examples:
ggplot2
Extensionsggplot2
is designed to be extensible:
Teaching advantage: Students learn one grammar, unlock dozens of tools
# Install key extensions
# pak::pak(c("patchwork", "gganimate", "ggtext", "plotly",
# "ggforce", "ggh4x", "ggrepel", "palmerpenguins"))
# Core packages
library(ggplot2)
library(palmerpenguins)
library(patchwork) # Combining plots
library(gganimate) # Animations
library(ggtext) # Enhanced text
library(plotly) # interactive plots
Teaching value: Students learn composition principles and complex figure creation for publications
gganimate
: Bringing Data to LifeStudent Exercise: Create before/after static vs. animated versions to show communication differences
ggtext
: Professional Text Formattinglibrary(ggtext)
ggplot(penguins, aes(bill_length_mm, body_mass_g, color = species)) +
geom_point() +
labs(
title = "Bill length vs. **Body mass**",
subtitle = "Data colored by <span style='color:blue;'>penguin species</span>",
caption = "*Source: Palmer Station Antarctica LTER*"
) +
theme(
plot.title = element_markdown(),
plot.subtitle = element_markdown(),
plot.caption = element_markdown()
)
Teaching Strategy: Have students develop their own theme as a semester project
ggplot2
Extension Teaching ResourcesComprehensive Guides:
Package-Specific Resources:
Teaching Materials:
Interactive plots enable:
Teaching opportunity: Students learn both exploration and communication
htmlwidgets: R bindings to JavaScript libraries that work in multiple contexts (console, RStudio, Rmarkdown, Shiny)
ggplot2
to plotly# Native plotly syntax
plot_ly(penguins, x = ~bill_length_mm, y = ~body_mass_g, color = ~species,
text = ~paste("Species:", species),
hovertemplate = "%{text}<br>Bill Length: %{x}mm<br>Body Mass: %{y}g") %>%
add_markers(size = ~bill_depth_mm) %>%
layout(title = "Interactive Penguin Data",
xaxis = list(title = "Bill Length (mm)"),
yaxis = list(title = "Body Mass (g)"))
ggiraph
: Interactive ggplot2
library(ggiraph)
# Add interactivity to ggplot2
p <- ggplot(penguins, aes(bill_length_mm, body_mass_g,
tooltip = paste("Species:", species),
data_id = species)) +
geom_point_interactive(aes(color = species), size = 3) +
theme_minimal()
# Render as interactive
girafe(ggobj = p)
Student-Friendly: Uses familiar ggplot2
syntax with _interactive
suffix
Comprehensive Learning:
htmlwidgets Ecosystem:
Teaching-Specific Resources:
Integration Examples:
Scaffolded Learning Approach:
Assessment Progression:
Visualization Theory & Principles:
R-Specific Advanced Techniques:
Teaching Methodology: