DS105 2025-2026 Autumn Term Icon

πŸ’» Week 05 Lab

Seaborn Visualisation & Documentation Navigation

Author

Dr Jon Cardoso-Silva

Published

13 December 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. Let’s put that into practice as we produce some plots!

Today is another πŸ§‘β€βœˆοΈ Pilot/πŸ™‹ Copilot lab!

πŸ“‹ 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 ? 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. Reading technical documentation is a core data science 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.

Preparation: πŸ‘₯ Together **Locate the notebook and data file(s). They should have already been added to the /files/week05/ folder on Nuvolos.

πŸ“₯ Download files (if unable to locate them on Nuvolos)

Place the notebook in the /files/week05/ folder and the data file in the /files/week05/data/ folder.

In case you have been following my W03 Extra advice, you can add this notebook to your my-ds105a-notes repository (for example, the notebook under my-ds105a-notes/week05/ and the data file under my-ds105a-notes/week05/data/).

🎯 ACTION POINTS

From now on, go through the steps below one by one.

  • πŸ§‘β€βœˆοΈ Pilot: you are the one typing code and saving relevant links
  • πŸ™‹ Copilot: you help by finding relevant information from your notes, the teaching materials, documentations, or online resources. If using AI chatbots, make sure to check if the code is correct and aligns with the DS105 code style.
  1. Load the CSV using pd.read_csv() into a pandas DataFrame called df.

  2. Inspect the data to get a sense of what it contains, how many rows and columns it has, and what the data types are.

  3. Quick question: Which city saw more rainfall in the past 12 months? Use groupby() and sum() to find the total rainfall for each city.

  4. How much has it rained in London (only) per month? Answer this question by creating a plot_df DataFrame.

  5. Create a bar plot using seaborn to visualise the rainfall per month for London.

  6. Work on plot titles:

    • Bad title: Create ONE very silly and useless title for the plot. Be ready to articulate why it is a bad title.
    • Good title: Create ONE good title for the plot. Be ready to articulate why it is a good title.

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

Do a bit of research (online sources, documentations, etc.) to find out how to save a plot as a PNG and an SVG.

  1. PNG: Save a fig01-london-rainfall-per-month.png file in the /files/week05/figures/ folder.

  2. SVG: Save a fig01-london-rainfall-per-month.svg file in the /files/week05/figures/ folder.

  3. Annotate: Create a Markdown cell in the notebook to explain: how did you discover how to write the code to save the plot as a PNG and an SVG?

    Was it from an online source (a tutorial? a Stack Overflow question? a documentation page? etc.)? How did you know if it was correct?

Task 03: Learn about FacetGrid (35 min)

Note to class teachers: This is the critical task about interpreting complicated documentation. Students must read the seaborn.FacetGrid docs themselves and discuss amongst themselves first. If they discover the answers with AI, help them understand how to confirm it against official docs. Explain the purpose of technical documentation and how to use it to learn new things.

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

🎯 ACTION POINTS

Don’t rush to implement the code! Actually slow down to read the (complex) documentation - to see if anything there makes sense - and discuss things together first.

  1. Visit the FacetGrid documentation and try to understand what this seaborn functionality does. Do NOT consult any other online source for now.

  2. Discuss: Before coding, align on what you think FacetGrid (and seaborn’s map() function) does based on the documentation alone.

  3. Do a first attempt at creating a FacetGrid to compare the monthly rainfall for London and Paris without checking any other online source.

  4. Document your first attempt in a Markdown cell in the notebook. If it didn’t work, what went wrong?

  5. Fix any potential issues - this time, yes, using online sources/AI chatbots if necessary.

  6. Write a narrative title that summarises the findings of this new plot.

    If you have time, feel free to come up with awful titles just for the laugh before you create the good one.

  7. Write down: What are the advantages of using FacetGrid over 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 the my-ds105a-notes repository.

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

🎯 ACTION POINTS

  1. Create REPORT.md in /files/week05/ (or /files/my-ds105a-notes/week05/ if using the my-ds105a-notes repository)

  2. Use Markdown to embed the two (or more) plots you created in the previous tasks.

  3. Add minimal text explaining what the data shows

  4. Add a conclusion comparing London and Paris rainfall patterns


Wrap-Up & Next Steps (? min)

Note to class teachers: If time allows, remind students about ✍️ Mini-Project 1 due in Reading Week (W06). Explain how today’s skills are essential for their NB02 and NB03 (including the research of the technical documentation)

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): No lectures or labs, but there are two drop-in sessions (Tuesday 10am-1pm with Jon and Wednesday 1-3pm with Pedro)

πŸ”— 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. Learning to discern what the technical documentation is saying and how to use it to learn new things is a core data science skill. Today you practiced this independently by reading FacetGrid docs and creating a markdown report!