Complete the code to create a figure and axes for subplots.
fig, axes = plt.subplots([1])The plt.subplots function creates a figure and a set of subplots. Here, 2 means two subplots in one row.
Complete the code to plot data on the first subplot.
axes[[1]].plot(data['x'], data['y1'])
Subplot axes are indexed starting at 0, so the first subplot is axes[0].
Fix the error in the code to set the title of the second subplot.
axes[1].[1]('Second Chart')
title instead of set_title causes an attribute error.setTitle is incorrect in matplotlib.The correct method to set a title on an axes object is set_title().
Fill both blanks to create two subplots in one column and plot data on the second subplot.
fig, axes = plt.subplots([1], [2]) axes[1].plot(data['x'], data['y2'])
To create two subplots stacked vertically, use plt.subplots(2, 1). Then axes[1] is the second subplot.
Fill all three blanks to create a 2x2 grid of subplots, plot on the bottom right, and set its title.
fig, axes = plt.subplots([1], [2]) axes[[3]].plot(data['x'], data['y3']) axes[[3]].set_title('Bottom Right')
A 2x2 grid means 2 rows and 2 columns. The bottom right subplot is at index 3 (zero-based counting).