UC San Diego
COGS 137 - Fall 2026
2026-11-23
Q: What did you work on while in Austin at snake_case?
A: We worked on extending ggplot2 into the python world. The package plotnine) already exists and implements the grammar of graphics in python. But, many of the helpful extensions that exist for ggplot2 do not yet exist for python. So, we built them and you can see them here: https://github.com/snake-case-ggtext. To support this (also in that org), we also built an app that will compare the R and python output and iteratively improve the code until they match (plotparity). And I went on a side-quest to build a package that could act as a plot linter to give students feedback on how the viz they generated fall short of best practices (plotnine-linter)
Q: When talking about parts of our final project, how do we account for an area’s income for college preparedness?
A: Depends on what you’re doing, but typically this would be included as a covariate (predictor in the model), to adjust findings for effect of income.
Q:I’m still a little confused about what cross-validation is and how it works.
A: Most simply cross-validation allows us to take our training data and split it into folds. Folds are a portion ofthe data. If you have 4 folds, 25% of the training data is in each fold. Then, you repeat the process of training the data on all but one of the folds and then seeing how it performs on the fold that was held out. Each time you repeat the process, a different fold is held out…and you calculate model performance on the held-out fold. Then you average across the folds for a performance metric. If you’re trying out two different models, you would then compare performance across models, selecting the better-performing model.
Due Dates (rest of quarter):
Notes:
In written communication we covered:
All of that still applies. Today: what changes when your audience is listening instead of reading?
| Report 📄 | Presentation 🎤 | |
|---|---|---|
| Who controls the pace? | the reader | you |
| Missed something? | re-read it | it’s gone |
| Where does the explanation live? | in the text | in your voice |
| How much on one visualization? | more (they have time) | less; build it up |
| How much detail? | all the necessary details | only what supports the take-home |
You’ve seen your figures 100 times. Your audience is seeing them for the first time.
🧠 What’s the best (or worst) presentation advice you’ve ever been given?
Before you open Google Slides/PowerPoint/Quarto:
A rough budget:
| Part | Time | Slides |
|---|---|---|
| Title + hook: your question & why it matters | ~45 sec | 1-2 |
| Data: where it’s from, what’s measured | ~45 sec | 1 |
| Approach: what you did (briefly!) | ~45 sec | 1 |
| Results: your 1-2 key findings | ~2 min | 2 |
| Conclusion: take-home + a limitation | ~45 sec | 1 |
They already know
➡ does not need a review/explanation
They don’t know
➡ spend your time here
.qmd/HTML ❌Those details belong in your report (or in backup slides after your conclusion).
Same rule as figure titles: the title is the main point you want people to leave with.
Avoid: “Introduction”
Better: “Cannabis use is on the rise”
Avoid: “Results”
Better: “THC concentration >5ng/mL suggests recent use”
Headline test: read only your slide titles in order. Do they tell your story?
. . . or incremental; Google Slides/PowerPoint: Animation ➡ Appear, on clicktheme_minimal(base_size = 18)It feels slow. It isn’t. This is how you get your audience to see what you see.
The audience looks where you’re pointing, instead of at the whole figure at once.
Let’s try it with CS01 data: THC in whole blood after smoking, comparing frequent and occasional users (placebo group excluded).
🗣️“Time since smoking is on the the x-axis, from before smoking out to five hours. y-axis is log scale THC measurements from blood.”
🗣️ “Here are occasional users. THC spikes in the first 30 minutes, then drops fast. After about three hours, there’s very little left.”
🗣️ “Frequent users follow the same pattern, but their line is above occasional users at every single time point.”
🗣️ “And look before anyone smoked: frequent users already have THC in their blood (median 1.25 ng/mL); occasional users have none (median 0 ng/mL).”
Same plot code each time, adding one layer per step:
base_plot <- ggplot(thc_time, aes(x = timepoint, y = median_thc, color = group)) +
coord_cartesian(ylim = c(0, 60)) + # fix the axes so they don't jump
labs(title = "\n") # reserve space for the title you add at the end
step1 <- base_plot + geom_blank() # just the axes
step2 <- base_plot + geom_line(data = filter(thc_time, group == "Occasional user"))
# ...and so on🧠 Pick one figure from your final project rough draft. Walk your neighbor through it using the 5 steps. (~60 seconds)
Listener: Could you follow it? Did you know what the axes were before you were told the point? Then swap.
So everyone needs to understand the whole project, not just their part:
🧠 As a group: write down 5 questions you’d ask if you were in the audience.
Common ones:
Then practice answering them, rotating who answers.
Talk
Slides
Figures