Task 4
Plot running data
Now we can create our first plot! As we found earlier, most of the activities in my data were running (459 of them to be exact). There are only 29, 18, and two instances for cycling, walking, and unicycling, respectively. So for now, let's focus on plotting the different running metrics.
An excellent first visualization is a figure with four subplots, one for each running metric (each numerical column). Each subplot will have a different y-axis, which is explained in each legend. The x-axis, Date
, is shared among all subplots.
Plot running data from 2013 through 2018.
Subset
df_run
for data from 2013 through 2018. Take into account that observations in dataset stored in chronological order - most recent records first. Assign the result toruns_subset_2013_2018
.In the plotting code, enable subplots by setting the
subplots
parameter toTrue
. Don’t use spaces around the=
sign when used to indicate a keyword argument, as recommended in PEP 8 style guide for Python code.Show the plot using
plt.show()
.
Helpful links:
Subset time series data exercise from Visualizing Time Series Data in Python
pandas.DataFrame.plot
documentationmatplotlib
cheat sheetPEP 8 guide: Other recommendations
Last updated