The current Axes that plt commands act on

Predict the output · Medium · §2.3 Two ways to make a chart

This code draws listener charts for the campus radio station's morning show and night show in the plt style. Trace which Figure's Axes each command applies to, and write what the code prints when it runs. You can get the Axes in a Figure as a list with fig.axes.

Code

import matplotlib.pyplot as plt

fig = plt.figure(figsize=(5, 3))
print(len(fig.axes))
plt.plot(["6am", "7am", "8am"], [35, 58, 47])
plt.title("Morning show listeners")
print(len(fig.axes))
fig2 = plt.figure(figsize=(5, 3))
plt.title("Night show listeners")
print(len(fig.axes), len(fig2.axes))

Solve this problem in your browser

Python runs in your browser and checks your answer right away. Hints and the answer are on the problem page.