0
0
Matplotlibdata~10 mins

Storytelling with visualization sequence 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 library for plotting.

Matplotlib
import [1] as plt
Drag options to blanks, or click blank then click option'
Amatplotlib.pyplot
Bmatplotlib
Cmpl
Dpyplot
Attempts:
3 left
💡 Hint
Common Mistakes
Importing just 'matplotlib' does not give direct access to plotting functions.
Using 'pyplot' without 'matplotlib.' prefix causes an error.
2fill in blank
medium

Complete the code to create a line plot of x and y data.

Matplotlib
plt.[1](x, y)
plt.show()
Drag options to blanks, or click blank then click option'
Abar
Bplot
Cscatter
Dhist
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'scatter' creates points without connecting lines.
Using 'bar' or 'hist' creates different chart types.
3fill in blank
hard

Fix the error in the code to add a title to the plot.

Matplotlib
plt.title([1])
Drag options to blanks, or click blank then click option'
AStory of Sales"
BStory of Sales
C'Story of Sales
D"Story of Sales"
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting quotes causes a NameError.
Using mismatched quotes causes syntax errors.
4fill in blank
hard

Fill both blanks to create a bar chart with labels and show the plot.

Matplotlib
plt.[1](categories, values)
plt.[2]()
Drag options to blanks, or click blank then click option'
Abar
Bshow
Cplot
Dtitle
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'plot' instead of 'bar' creates a line plot.
Forgetting 'show' means the plot won't appear.
5fill in blank
hard

Fill all three blanks to create a scatter plot with labels and a title.

Matplotlib
plt.[1](x, y)
plt.xlabel([2])
plt.title([3])
plt.show()
Drag options to blanks, or click blank then click option'
Ascatter
B"Time (days)"
C"Growth over Time"
Dplot
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'plot' instead of 'scatter' changes the plot type.
Forgetting quotes around labels causes errors.