0
0
Matplotlibdata~10 mins

What is Matplotlib - Interactive Quiz & 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 library.

Matplotlib
import [1] as plt
Drag options to blanks, or click blank then click option'
Amatplotlib.pyplot
Bnumpy
Cpandas
Dseaborn
Attempts:
3 left
💡 Hint
Common Mistakes
Importing numpy or pandas instead of matplotlib.pyplot
Forgetting to import pyplot submodule
2fill in blank
medium

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

Matplotlib
plt.[1]([1, 2, 3], [4, 5, 6])
plt.show()
Drag options to blanks, or click blank then click option'
Abar
Bscatter
Cplot
Dhist
Attempts:
3 left
💡 Hint
Common Mistakes
Using scatter instead of plot for line plots
Using hist or bar which are for other chart types
3fill in blank
hard

Fix the error in the code to display the plot correctly.

Matplotlib
import matplotlib.pyplot as plt
plt.plot([1, 2, 3], [3, 2, 1])
[1]()
Drag options to blanks, or click blank then click option'
Adisplay
Bshow
Cdraw
Drender
Attempts:
3 left
💡 Hint
Common Mistakes
Calling display() or draw() which do not exist in matplotlib
Forgetting to call any function to show the plot
4fill in blank
hard

Fill both blanks to create a bar chart with labels.

Matplotlib
plt.[1](['A', 'B', 'C'], [5, 7, 3])
plt.[2]('Categories')
plt.show()
Drag options to blanks, or click blank then click option'
Abar
Bxlabel
Cylabel
Dplot
Attempts:
3 left
💡 Hint
Common Mistakes
Using plot() instead of bar() for bar charts
Using ylabel() instead of xlabel() for x-axis label
5fill in blank
hard

Fill all three blanks to create a scatter plot with title and y-axis label.

Matplotlib
plt.[1]([1, 2, 3], [4, 5, 6])
plt.[2]('My Scatter Plot')
plt.[3]('Values')
plt.show()
Drag options to blanks, or click blank then click option'
Aplot
Btitle
Cylabel
Dscatter
Attempts:
3 left
💡 Hint
Common Mistakes
Using plot() instead of scatter() for scatter plots
Confusing xlabel and ylabel
Forgetting to add title