I like making figures - but oooh dang this project got me!

Click here to see the notebook on GitHub.

Click here to see the notebook on GitHub.

I like making figures. It’s usually the first thing I do when planning an experiment or manuscript draft. I like to draw them out on paper and think about what stats I’ll need and what the wow figure will be. I’ve been enjoying teaching myself data science concepts and skills. The process so far has been to follow along with the tutorial and then apply those skills to an idea you come up with to explore using the same dataset. But this project was a doozy! Using matplotlib and the storytelling style of fivethirtyeight figures, I had to create the coordinates for an interesting visualization.

I had ideas of what I wanted to show - 5 blocks of graphs for distinct periods of time and 1 block of the entire timeline under it. Um this was not nearly as easy as I expected.

Yikes.

Yikes.

This was my result after trying multiple ways to draw different plot sizes. I got the long coordinates! Of course, it wasn’t where I wanted to be. And I couldn’t get my data to show up on this.

Closer!

Closer!

This attempt was slightly better! I figured out how to get some data on the graph, it wasn’t my data, but you can see a line that could be data! I also tried to adjust the label positions and titles - one of them shows up! 2015-2021 is right there! It’s just in the middle, oops.

It’s happening!!!

It’s happening!!!

I’m so close! And yes, this is the whole image. Saving the figure as output didn’t seem to give the entire masterpiece. Here I managed to get 5 separate plots on top with the long combination plot on the bottom. I tried so many times to get the coordinates lined up but they just continued to overlap. There is also an issue with the leftmost plot - it isn’t scaled correctly. I wanted a smoother line so I used the .mean() attribute but it never got that nice flowing ribbon. I did get colors associated with each time block to appear! Small wins!

E for effort?

E for effort?

In the end I managed to get my data plotted in 6 separate plots with a single plot on the bottom with the combination of all of them. The scale for all 7 plots is actually pretty close! I couldn’t manage to get the axes labels and ticks to space nicely on the smaller plots. Also the math smoothed the main plot so much you can’t match the variation in changes to the above plots.

In the end this was as far as I got before I lost my mind and will to finish. I’m going to give it a few weeks rest and move on to the next project. I plan to come back and tackle this some more. I haven’t identified the resource I want to use to figure this out. But I am determined to get these plots completed with matplotlib (or other appropriate method).

Data is so dirty!