0
0
Matplotlibdata~10 mins

Zoom and pan with toolbar 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 import the matplotlib pyplot module.

Matplotlib
import matplotlib.[1] as plt
Drag options to blanks, or click blank then click option'
Apyplot
Bplot
Ccharts
Dgraph
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'plot' instead of 'pyplot' causes import errors.
Trying to import 'charts' or 'graph' which do not exist in matplotlib.
2fill in blank
medium

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

Matplotlib
fig, ax = plt.[1]()
Drag options to blanks, or click blank then click option'
Aplot
Bshow
Csubplots
Dfigure
Attempts:
3 left
💡 Hint
Common Mistakes
Using plot() returns a line, not figure and axes.
Using figure() returns only the figure, no axes.
3fill in blank
hard

Fix the error in the code to plot a simple line on the axes.

Matplotlib
ax.[1]([1, 2, 3], [4, 5, 6])
Drag options to blanks, or click blank then click option'
Aplot
Bdraw
Cshow
Dscatter
Attempts:
3 left
💡 Hint
Common Mistakes
Using draw() which is not a method of axes.
Using show() which displays the figure but does not plot data.
4fill in blank
hard

Fill both blanks to enable the toolbar and display the plot with zoom and pan.

Matplotlib
plt.[1]()
plt.[2]()
Drag options to blanks, or click blank then click option'
Ashow
Bdraw
Cfigure
Dpause
Attempts:
3 left
💡 Hint
Common Mistakes
Using figure() instead of draw() does not refresh the plot.
Using pause() is for animation, not toolbar activation.
5fill in blank
hard

Fill all three blanks to create a plot with zoom and pan enabled and set the title.

Matplotlib
fig, ax = plt.[1]()
ax.[2]([10, 20, 30], [1, 4, 9])
ax.set_[3]('Zoom and Pan Example')
Drag options to blanks, or click blank then click option'
Asubplots
Bplot
Ctitle
Dxlabel
Attempts:
3 left
💡 Hint
Common Mistakes
Using figure() instead of subplots() misses axes creation.
Using xlabel instead of title sets the x-axis label, not the title.