0
0
Pandasdata~10 mins

Subplots for multiple charts in Pandas - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a figure and axes for subplots.

Pandas
fig, axes = plt.subplots([1])
Drag options to blanks, or click blank then click option'
A3
B2
C1
D4
Attempts:
3 left
💡 Hint
Common Mistakes
Using a number larger than needed creates extra empty plots.
Forgetting to import matplotlib.pyplot as plt.
2fill in blank
medium

Complete the code to plot data on the first subplot.

Pandas
axes[[1]].plot(data['x'], data['y1'])
Drag options to blanks, or click blank then click option'
A0
B-1
C2
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Using 1 instead of 0 causes an index error or plots on the second subplot.
Using negative indices without understanding their meaning.
3fill in blank
hard

Fix the error in the code to set the title of the second subplot.

Pandas
axes[1].[1]('Second Chart')
Drag options to blanks, or click blank then click option'
Aset_title
Btitle
CsetTitle
Dtitles
Attempts:
3 left
💡 Hint
Common Mistakes
Using title instead of set_title causes an attribute error.
Using camelCase like setTitle is incorrect in matplotlib.
4fill in blank
hard

Fill both blanks to create two subplots in one column and plot data on the second subplot.

Pandas
fig, axes = plt.subplots([1], [2])
axes[1].plot(data['x'], data['y2'])
Drag options to blanks, or click blank then click option'
A2
B1
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping rows and columns causes unexpected layout.
Using indices out of range for axes.
5fill in blank
hard

Fill all three blanks to create a 2x2 grid of subplots, plot on the bottom right, and set its title.

Pandas
fig, axes = plt.subplots([1], [2])
axes[[3]].plot(data['x'], data['y3'])
axes[[3]].set_title('Bottom Right')
Drag options to blanks, or click blank then click option'
A2
B3
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong indices for the bottom right subplot.
Mixing up rows and columns in plt.subplots.