I used a combination of Matplotlib (a graphics package for Python), Flask (micro webframework for Python that has been used by a company as big as LinkedIn) and Heroku (for being able to put the graphs online - before Heroku axed their free tier) to do a variety of graphs earlier in the COVID-19 pandemic.
Accessibility note: given how many people are affected by colour blindness (e.g. 4.5% of UK population) I should have remembered to note in all the following graphs the green line is the triangles and the blue line is the dots (now noted in captions).
Dual axis charts
There are some good reasons to not do dual axis charts - but I wanted to do some and you can do them in Matplotlib (while Hadley Wickham has arguments against them and does not support them in his popular R charting library, ggplot2).
Cases & admissions
Note that cases data is heavily dependent on testing - which has varied in the pandemic. There was relative scarcity of testing initially - then there was the development of lateral flow tests and their free supply to the public and then that free supply was terminated. So cases to admissions ratio comparisons only make sense within short time periods - when one is sure the testing policy and supply of tests is comparable.
Cases - by publication date and rolling 7 day average
A more prosaic use of plotting dual axes shows the rolling 7 day average and the cases by publication date.
The rise of Omicron
As you’d expect the rise of the Omicron variant shows up in the charts.
Data retrieved from UK government API (data believed to be under Open Government Licence v3.0).
Note that 7d averages seen above were calculated using pandas .rolling(7).mean()
method on the dataframe and unlike the UK government dashboard includes figures from previous 5 days (which may be incomplete) - so accuracy for the latest 7d average was sacrificed in favour of including the latest data.
Note also that graphs were the data as available at the time and there may have been revisions (e.g. issues with lab tests).