0
0
Matplotlibdata~10 mins

How Matplotlib renders figures - Interactive Practice

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

Complete the code to import the Matplotlib plotting module.

Matplotlib
import matplotlib.[1] as plt
Drag options to blanks, or click blank then click option'
Afigure
Bplot
Cpyplot
Dimage
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'plot' instead of 'pyplot' causes import errors.
Trying to import 'figure' directly is incorrect.
2fill in blank
medium

Complete the code to create a new figure object.

Matplotlib
fig = plt.[1]()
Drag options to blanks, or click blank then click option'
Ashow
Bfigure
Cplot
Ddraw
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'plot()' creates a plot but not a figure object.
Using 'show()' displays the plot but does not create a figure.
3fill in blank
hard

Fix the error in the code to add a subplot to the figure.

Matplotlib
ax = fig.[1](111)
Drag options to blanks, or click blank then click option'
Aadd_subplot
Badd_subplots
Csubplots
Dsubplot
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'subplot' directly on figure causes attribute errors.
Using 'subplots' returns multiple axes, not a single subplot.
4fill in blank
hard

Fill both blanks to plot data and display the figure.

Matplotlib
ax.[1]([1, 2, 3], [4, 5, 6])
plt.[2]()
Drag options to blanks, or click blank then click option'
Aplot
Bshow
Cscatter
Ddraw
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'scatter' instead of 'plot' changes the plot type.
Using 'draw' instead of 'show' does not display the window.
5fill in blank
hard

Fill all three blanks to create a figure, add a subplot, and plot data.

Matplotlib
fig = plt.[1]()
ax = fig.[2](111)
ax.[3]([10, 20, 30], [1, 4, 9])
Drag options to blanks, or click blank then click option'
Afigure
Badd_subplot
Cplot
Dshow
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up 'add_subplot' and 'subplots'.
Forgetting to call 'plot()' on the axes object.