0
0
Matplotlibdata~10 mins

Dashboard layout patterns 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 with a grid layout of 2 rows and 2 columns.

Matplotlib
fig, axs = plt.subplots([1], 2)
Drag options to blanks, or click blank then click option'
A2
B4
C3
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Using 1 row instead of 2.
Confusing rows and columns.
2fill in blank
medium

Complete the code to set the figure size to 10 inches wide and 8 inches tall.

Matplotlib
fig, axs = plt.subplots(2, 2, figsize=([1], 8))
Drag options to blanks, or click blank then click option'
A12
B8
C10
D6
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping width and height values.
Using too small or too large numbers.
3fill in blank
hard

Fix the error in the code to add a title to the first subplot.

Matplotlib
axs[0, 0].[1]('Sales Over Time')
Drag options to blanks, or click blank then click option'
Atitle
Bset_title
Cadd_title
Dplot_title
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'title' instead of 'set_title'.
Trying to use non-existent methods like 'add_title'.
4fill in blank
hard

Fill both blanks to adjust spacing between subplots and add a main title to the figure.

Matplotlib
fig.[1](hspace=0.5)
fig.[2]('Dashboard Overview')
Drag options to blanks, or click blank then click option'
Asubplots_adjust
Bsuptitle
Cset_title
Dtight_layout
Attempts:
3 left
💡 Hint
Common Mistakes
Using set_title on the figure instead of suptitle.
Trying to adjust spacing with tight_layout without parameters.
5fill in blank
hard

Fill all three blanks to create a 3-row, 1-column layout, set figure size, and add a title to the last subplot.

Matplotlib
fig, axs = plt.subplots([1], [2], figsize=([3], 12))
axs[2].set_title('Profit Analysis')
Drag options to blanks, or click blank then click option'
A3
B1
C10
D2
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping rows and columns values.
Using wrong figure size dimensions.