Welcome to d3aday! If this is your first time, we recommend reading the about page before jumping in.
The Inspiration
For this exercise, I took inspiration from Philippe “Fil” Rivière’s take on climate change in Minneapolis on Observable.
I liked how Fil’s viz makes use of small multiples to combine two types of graphs. The trend lines are of course a key feature of his data story, but they introduce more complexity into the code than I wanted for this quick exercise.
The Exercise
Simplifying things a bit, this exercise focuses on accomplishing the basics: using monthly temperatures over a span of years, graph scatter plots by month and combine them.
For this exercise, I wanted to use data from my hometown instead of Minneapolis. I was able to find historical monthly temperatures for Raleigh, and used Python to scrape and munge the data into something usable.
If you’re interested, here’s the Python scraping code.
A Solution
My solution to this exercise looks like this:
A key technique for this is to calculate the x coordinates for each dot by combining 2 scales, e.g.:
My solution is below, but I encourage you to attempt it first without peeking. The full code and working example can be found on codepen. The temperature data is here.