In-Class Studio: AI Visual Audit
Where this fits
You have the worked example (viz03), the audit categories (viz04), and the AI-prompt pattern (viz05). This page is the in-class studio where you put all three to work: read a deliberately flawed plot, identify at least three problems, revise the plot, and write a short audit note. The same workflow is what Assignment 5 expects, so think of this as the dress rehearsal.
Before you start
Take 2 minutes to check that your Codespace is ready:
library(tidyverse)runs without error.- The cached data file resolves from the repository root:
examples/nhanes-equity/data/nhanes_equity_v6.csv. - The rendered Week 6 worked example opens in the course book; you do not need its source file in your personal workspace.
If any of those three fail, raise it with your debugging partner before moving on.
Goal
Evaluate one AI-generated visualization for correctness, clarity, bias, aggregation choices, and misleading design. Then revise it so the visual matches the evidence.
Inputs
- Worked example to compare against:
weeks/week06-visualization/viz03-worked-example.qmd - Dataset:
examples/nhanes-equity/data/nhanes_equity_v6.csv(view on GitHub) - Flawed plot code in your personal workspace (the artifact you will audit):
assignments/assignment05-visualization/flawed-plot-code.R
Activity Steps
- Review the worked example and note how it labels the data source, statistic, and limitation.
- In your personal workspace, open
assignments/assignment05-visualization/flawed-plot-code.Rand read the comments and output labels before you run it. - Run the script from your personal workspace root with
source("assignments/assignment05-visualization/flawed-plot-code.R"). - Look at the figure. It may appear in a plot viewer pane. If it does not, no problem: the script also saves
flawed-plot.pngin your current working folder (rungetwd()if you are unsure where that is). Find the PNG in the Explorer, right-click it, and choose Open Preview. - List at least three issues that could mislead a reader. Tag each one with one of the audit categories below.
- Revise the plot so the title, scale, grouping, and caption match the evidence. Keep the cohort restriction explicit.
- Write a short note explaining what you changed and why.
Audit Categories
- Correctness: Does the plot show what the title and labels claim?
- Design: Do scale, color, ordering, and geometry support fair comparison?
- Interpretation: Does the caption avoid causal or population-level claims that the plot cannot support?
- Bias and aggregation: Could grouping, missingness, or small counts hide important variation?
- Reproducibility: Can another person rerun the code from the repository root using relative paths?
Required Outputs (studio draft)
These are the draft files you produce in class. The Assignment 5 deliverable list (viz07) is the same set, polished.
visual-audit-note.md— at least three issues with category, why it matters, and the corrected approach.visualization-audit.qmd— a rerunnable Quarto file that creates the corrected plot and explains the revision.corrected-plot.png— the exported corrected plot.caption.md— a caption that states the statistic, data source, exclusions, and limitations.ai-use-note.md— if you used AI, explain what it helped with and how you checked the result.
Each entry in visual-audit-note.md should give this level of evidence. This example is generic — it is not one of the planted issues in this studio’s plot:
- Issue: the draft layered
geom_smooth(method = "lm")across NHANES cycles. - Category: design.
- Why it matters: cycles are categorical labels, so a regression line implies a continuous trend the data cannot support.
- Correction: replaced the smoother with
geom_line() + geom_point()connecting the cycle summaries.
Completion Check
You are done with the studio when a peer can rerun your corrected plot, identify the main comparison without reading your code, and see at least one explicit limitation in the caption.
Where this goes next
Polish the studio drafts into the Assignment 5 submission. viz07 walks through the seven A5 files one by one and connects the work to the M1 visual plan due the same week.