0
0
Matplotlibdata~10 mins

Why customization matters in Matplotlib - Test Your Understanding

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 library.

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.
2fill in blank
medium

Complete the code to create a simple line plot of y values.

Matplotlib
plt.[1]([1, 2, 3, 4], [10, 20, 25, 30])
plt.show()
Drag options to blanks, or click blank then click option'
Aplot
Bline
Cdraw
Dgraph
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'draw' or 'line' which are not matplotlib functions.
Trying to use 'graph' which is not a valid method.
3fill in blank
hard

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

Matplotlib
plt.plot([1, 2, 3], [4, 5, 6])
plt.[1]('My Plot')
plt.show()
Drag options to blanks, or click blank then click option'
Aset_title
Badd_title
Ctitle
Dplot_title
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'set_title' which is a method for axes objects, not pyplot.
Trying 'add_title' or 'plot_title' which do not exist.
4fill in blank
hard

Fill both blanks to customize the x-axis and y-axis labels.

Matplotlib
plt.plot([1, 2, 3], [4, 5, 6])
plt.xlabel([1])
plt.[2]('Value')
plt.show()
Drag options to blanks, or click blank then click option'
A'Time'
Bylabel
Cxlabel
D'Amount'
Attempts:
3 left
💡 Hint
Common Mistakes
Using plt.xlabel twice or plt.ylabel as a string.
Confusing the label names or functions.
5fill in blank
hard

Fill all three blanks to create a customized scatter plot with color and size.

Matplotlib
plt.scatter([1, 2, 3], [4, 5, 6], c=[1], s=[2], marker=[3])
plt.show()
Drag options to blanks, or click blank then click option'
A'red'
B100
C'o'
D'blue'
Attempts:
3 left
💡 Hint
Common Mistakes
Using invalid marker symbols or wrong data types for size.
Confusing color strings or missing quotes.