Screen Link:
https://app.dataquest.io/m/526/storytelling-data-visualization/4/modifying-the-line-plots
My Code:
import pandas as pd
import matplotlib.pyplot as plt
death_toll = pd.read_csv('covid_avg_deaths.csv')
fig, (ax1, ax2, ax3, ax4) = plt.subplots(nrows=4, ncols=1,
figsize=(6,8))
axes = [ax1, ax2, ax3, ax4]
for ax in axes:
ax.plot(death_toll['Month'], death_toll['New_deaths'],
color='#b00b1e', alpha=0.1)
ax.set_yticklabels([])
ax.set_xticklabels([])
ax.tick_params(bottom=0, left=0)
for location in ['left', 'right', 'top', 'bottom']:
ax.spines[location].set_visible(False)
ax1.plot(death_toll['Month'][:3], death_toll['New_deaths'][:3],
color='#b00b1e', linewidth=2.5)
ax2.plot(death_toll['Month'][2:6], death_toll['New_deaths'][2:6],
color='#b00b1e', linewidth=2.5)
ax3.plot(death_toll['Month'][5:10], death_toll['New_deaths'][5:10],
color='#b00b1e', linewidth=2.5)
ax4.plot(death_toll['Month'][9:12], death_toll['New_deaths'][9:12],
color='#b00b1e', linewidth=2.5)
plt.show()
What I expected to happen:
Code to run
What actually happened:
/dataquest/system/env/python3/lib/python3.8/site-packages/plotly/matplotlylib/mpltools.py:368: MatplotlibDeprecationWarning:
The is_frame_like function was deprecated in Matplotlib 3.1 and will be removed in 3.3.
This is preventing from completing the entire course on Storytelling Data Visualization