Home/Data Analytics/UK COVID-19 Daily Cases
Data visualization · Python

UK COVID-19 Daily Cases

An interactive Python line chart of UK daily COVID-19 cases, built with pandas, Matplotlib and mplcursors.

RoleIndividual project
Year2025
ToolsPython, pandas, Matplotlib, mplcursors, VS Code

At a glance

The result

Line chart of UK daily COVID-19 cases over time
UK daily COVID-19 cases over time. In the live notebook the chart is interactive: hovering shows the exact date and number of cases.

The resulting plot gives a visual representation of how case numbers fluctuated over time, and the hover interaction makes it easy to explore specific days.

Under the hood

Environment

I wanted to work in VS Code, having previously used Jupyter Notebook in the browser through Anaconda. So I created the notebook in VS Code, linked it to the right Python kernel, and installed the libraries the notebook imports.

Data preparation

I downloaded the dataset and loaded it into a pandas DataFrame, which I sorted by date. I then extracted two arrays, x for dates and y for daily case numbers, to make plotting simple.

Plotting

I used Matplotlib to draw the line plot, with these key features:

  • figure.figsize = (16, 6) for a wide layout that suits a long time series;
  • labels for the x-axis (Date), y-axis (Number of Daily Cases) and the title; and
  • mplcursors to enable hover tooltips showing the exact date and value.
%matplotlib inline
import matplotlib.pyplot as mplt
import mplcursors

mplt.plot(x, y)
mplt.xlabel('Date')
mplt.ylabel('Number of Daily Cases')
mplt.title('UK Daily COVID-19 Cases Over Time')

mplt.rcParams["figure.figsize"] = (16, 6)

cursor = mplcursors.cursor(hover=True)

mplt.show()

What I would improve next

  • Parse dates explicitly. Convert the date column with pd.to_datetime so the x-axis shows real calendar dates. In the exported image the date labels look like epoch-style values, a classic sign that the dates were plotted as numbers.
  • Show a rolling average. Daily counts are noisy; a seven-day average would make the trend easier to read.
  • Add the data source and date range to the chart caption so it is fully traceable.

Files

Skills demonstrated

pandasMatplotlibInteractive charts (mplcursors)VS Code and JupyterTechnical writing