DS105 2025-2026 Autumn Term Icon

πŸ’» Week 05 Lab

Seaborn Visualisation & Documentation Navigation

Author

Dr Jon Cardoso-Silva

Published

27 October 2025

πŸ₯… Learning Goals

By the end of this lab, you should be able to: i) Filter data and create bar plots with seaborn, ii) Export plots in multiple formats (PNG vs SVG), iii) Navigate technical documentation to learn FacetGrid, iv) Create markdown reports with embedded figures.

This lab builds directly on πŸ–₯️ W05 Lecture where you learned about the apply() and .groupby() functions and you learned of how, in DS105, we want to produce a plot_df prior to any plot. Today you’ll work in pairs to master seaborn visualisation and learn how to navigate technical documentation independently.

πŸ“‹ Preparation

  • Attend or at least watch the πŸ–₯️ W05 Lecture, where you learned about .groupby() and temporal grouping
  • Find a partner for pair programming. You’ll swap roles halfway through the lab (your class teacher will mediate this)

πŸ›£οΈ Lab Roadmap

Task Activity Type Focus Time Outcome
Task 01 🎯 ACTION POINTS Filtering & Bar Plots 25 min Create plot + discuss narrative titles
Task 02 🎯 ACTION POINTS File Export 10 min Learn PNG vs SVG differences
Task 03 πŸ“š DOCUMENTATION FacetGrid Discovery 35 min Read docs + create comparison plot
Task 04 πŸ“ STORYTELLING Report Creation 20 min Create markdown report with embedded figures
Wrap-Up πŸ—£οΈ TEACHING MOMENT Mini-Project 1 10 min Connect skills to assessment

πŸ’‘ Today’s Design: You’ll learn to navigate seaborn documentation independently. Even if AI helps you with syntax, always verify it against the official documentation. This is a real-world skill!

Task 01: Your First Plot (25 min)

Note to class teachers: Students work through Task 01. The Pilot types while the Copilot guides. Emphasise the plot_df pattern from W05 Lecture. The title/subtitle discussion is critical for narrative visualisation. Circulate to hear student conversations about what makes a good title.

Task 01 Goal: Filter the London/Paris data, create a bar plot, and discuss narrative titles.

🎯 ACTION POINTS

  1. πŸ§‘β€βœˆοΈ Pilot Load the CSV using pd.read_csv()

  2. πŸ‘₯ Together Filter for London only and create a plot_df for the past 12 months

  3. πŸ§‘β€βœˆοΈ Pilot Create a bar plot using seaborn

  4. πŸ‘₯ Together Work on plot titles β€” discuss which titles communicate findings vs just describe the data

Task 02: Export Your Plot (10 min)

Note to class teachers: Quick task. Students export in both formats and compare file sizes. The <details> box explains the technical difference briefly.

Task 02 Goal: Export your plot in multiple formats and understand the differences.

🎯 ACTION POINTS

  1. πŸ§‘β€βœˆοΈ Pilot Save as PNG β€” plt.savefig('output.png')

  2. πŸ§‘β€βœˆοΈ Pilot Save as SVG β€” plt.savefig('output.svg')

  3. πŸ‘₯ Together Compare file sizes and discuss when you might use each format

Task 03: FacetGrid Discovery (35 min)

Note to class teachers: This is the critical documentation reading task. Students must read the seaborn.FacetGrid docs themselves. Don’t provide the syntax - let them discover it. AI can help, but they should verify against official docs. This develops resourceful learning.

⚠️ SWAP ROLES! The Copilot from Task 01 is now the Pilot.

Task 03 Goal: Read documentation, understand FacetGrid, create London vs Paris comparison.

🎯 ACTION POINTS

  1. πŸ‘₯ Together Visit the FacetGrid documentation and read the examples

  2. πŸ‘₯ Together Discuss: What does the map() function do? Why is this useful for comparing cities?

  3. πŸ§‘β€βœˆοΈ New Pilot Create FacetGrid with London (top) and Paris (bottom)

  4. πŸ§‘β€βœˆοΈ New Pilot Write a narrative title comparing the two cities

  5. πŸ™‹ New Copilot: Explain WHY FacetGrid is better than two separate plots for this comparison

Task 04: Create a Report (20 min)

Note to class teachers: Students create a REPORT.md file with embedded figures. Encourage them to tell a story, not just list plots. Location: /files/week05/ for all students, or /files/my-ds105a-notes/week05/ for those using Git.

Task 04 Goal: Create a markdown report documenting your findings.

🎯 ACTION POINTS

  1. πŸ§‘β€βœˆοΈ Pilot Create REPORT.md in /files/week05/ (or /files/my-ds105a-notes/week05/ if using Git)

  2. πŸ§‘β€βœˆοΈ Pilot Use markdown to embed figures with ![](path/to/plot.png)

  3. πŸ‘₯ Together Write narrative sections explaining what the data shows

  4. πŸ‘₯ Together Add a conclusion comparing London and Paris rainfall patterns


Wrap-Up & Next Steps (10 min)

Note to class teachers: Remind students about Mini-Project 1 due in Reading Week (W06). Today’s skills (seaborn, file export, markdown reporting) directly support the assessment. If time allows, encourage pairs to start working on their Mini-Project 1 during the lab.

Looking Ahead:

  • ✍️ Mini-Project 1 due Thursday of Reading Week (W06) at 8pm
    • Today’s skills directly support your assessment
    • Continue working on data collection and transformation
  • πŸ–₯️ Next Monday (W06): Reading Week β€” dedicated project time
  • πŸ–₯️ Next Tuesday (W07): Return to lectures with SQL and database operations

πŸ”— Useful Resources

πŸ“Š Essential Guides

πŸ’» Course Materials

  • πŸ–₯️ W05 Lecture: Advanced pandas and visualisation
  • πŸ“ Mini-Project 1: Your first assessed project (due Reading Week)

πŸ†˜ Getting Help

  • Slack: Post questions to #help channel
  • Office Hours: Book via StudentHub
  • Check staff availability on βœ‹ Contact Hours

🌐 External Resources

πŸ’‘ Key Takeaway: Always verify AI-generated syntax against official documentation. Documentation reading is a core data science skill. Today you practiced this independently by reading FacetGrid docs!