π» Week 05 Lab
Seaborn Visualisation & Documentation Navigation
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_dfpattern 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
π§ββοΈ Pilot Load the CSV using
pd.read_csv()π₯ Together Filter for London only and create a
plot_dffor the past 12 monthsπ§ββοΈ Pilot Create a bar plot using seaborn
π₯ 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
π§ββοΈ Pilot Save as PNG β
plt.savefig('output.png')π§ββοΈ Pilot Save as SVG β
plt.savefig('output.svg')π₯ 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
π₯ Together Visit the FacetGrid documentation and read the examples
π₯ Together Discuss: What does the
map()function do? Why is this useful for comparing cities?π§ββοΈ New Pilot Create FacetGrid with London (top) and Paris (bottom)
π§ββοΈ New Pilot Write a narrative title comparing the two cities
π 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
π§ββοΈ Pilot Create REPORT.md in
/files/week05/(or/files/my-ds105a-notes/week05/if using Git)π§ββοΈ Pilot Use markdown to embed figures with
π₯ Together Write narrative sections explaining what the data shows
π₯ 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
- 3οΈβ£ Data Science Workflow: Complete workflow stages
- 4οΈβ£ Git & GitHub Guide: Version control commands
π» Course Materials
- π₯οΈ W05 Lecture: Advanced pandas and visualisation
- π Mini-Project 1: Your first assessed project (due Reading Week)
π Getting Help
- Slack: Post questions to
#helpchannel - Office Hours: Book via StudentHub
- Check staff availability on β Contact Hours
π External Resources
Seaborn Documentation: Visualisation library
Pandas Documentation: GroupBy and
.apply()
π‘ 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!
