Matplotlib
Overview
With this exercise, I was practising my skills using two Main Components from Matplotlib: Figure and Axes. The Figure object is like a canvas or a container that holds all elements of the plot. The Axes object refers to an individual plot or graph. A Figure can contain multiple Axes.
Loading a Covid dataset and basic plotting styles, I used Matplotlib functions to customize the plots with titles, labels, and legends, in order to visualize the data. Making sense of the data, we can uncover patterns, trends, and insights that may not be immediately apparent when examining raw data. Transforming numbers and statistics into visual forms, makes complex information more understandable and actionable.
To work with my data set, I first imported pandas and matplotlib.
Then I uploaded my data set with my read function, to have it in my data frame.
The next step is to use the head function to load the first 5 rows to have a look at the data set. I can see there are 9 columns with dates, countries, and cases among other relevant information.
A Line Plot of New COVID-19 Cases in Denmark
First I created a line chart to analyse the trend of new COVID-19 cases in Denmark over time. The x-axis represents the Date_reported, and the y-axis displays the number of new cases. The goal is to visualize how the number of cases fluctuated throughout the reported period in the dataset.
From the data gathered, this was the visual produced to display the findings more clearly.
Customized Line Plot
To change the default style, I redid the line plot applying a different colour and thickness, edited the title font to make it more prominent. I also set the rotation of the x-axis labels to 45 degrees.