0
0
Matplotlibdata~10 mins

Plt.subplots with rows and columns in Matplotlib - 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 with 2 rows and 1 column using plt.subplots.

Matplotlib
fig, axes = plt.subplots([1], 1)
Drag options to blanks, or click blank then click option'
A3
B1
C2
D4
Attempts:
3 left
💡 Hint
Common Mistakes
Using the number of columns as the first argument.
Forgetting to specify the number of rows.
2fill in blank
medium

Complete the code to create a figure with 3 rows and 2 columns of subplots.

Matplotlib
fig, axes = plt.subplots([1], 2)
Drag options to blanks, or click blank then click option'
A3
B1
C2
D4
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping rows and columns.
Using 2 instead of 3 for rows.
3fill in blank
hard

Fix the error in the code to create a 2x2 grid of subplots.

Matplotlib
fig, axes = plt.subplots(2, [1])
Drag options to blanks, or click blank then click option'
A1
B4
C3
D2
Attempts:
3 left
💡 Hint
Common Mistakes
Using 1 instead of 2 for columns.
Confusing rows and columns.
4fill in blank
hard

Fill both blanks to create a 3x3 grid of subplots and set the figure size to 9x9 inches.

Matplotlib
fig, axes = plt.subplots([1], [2], figsize=(9, 9))
Drag options to blanks, or click blank then click option'
A3
B2
C4
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Using different numbers for rows and columns.
Forgetting to set both to 3.
5fill in blank
hard

Fill all three blanks to create a 2x3 grid of subplots, set figure size to 10x6 inches, and assign the axes to a variable.

Matplotlib
fig, [1] = plt.subplots([2], [3], figsize=(10, 6))
Drag options to blanks, or click blank then click option'
Aaxes
B2
C3
Dfigsize
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong variable names for axes.
Swapping rows and columns numbers.