0
0
Matplotlibdata~10 mins

Why scatter plots show relationships 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 library for plotting.

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 the wrong library like pandas or numpy for plotting.
Forgetting to import pyplot specifically.
2fill in blank
medium

Complete the code to create a scatter plot with x and y data.

Matplotlib
plt.[1](x, y)
Drag options to blanks, or click blank then click option'
Ahist
Bline
Cbar
Dscatter
Attempts:
3 left
💡 Hint
Common Mistakes
Using plt.plot which draws lines, not scatter points.
Using bar or hist which are for different chart types.
3fill in blank
hard

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

Matplotlib
plt.scatter(x, y)
plt.[1]()
Drag options to blanks, or click blank then click option'
Ashow
Bdraw
Cplot
Ddisplay
Attempts:
3 left
💡 Hint
Common Mistakes
Using plt.plot() or plt.draw() which do not display the plot window.
Forgetting to call any function to display the plot.
4fill in blank
hard

Fill both blanks to create a scatter plot with labels for axes.

Matplotlib
plt.scatter(x, y)
plt.xlabel([1])
plt.[2]('Y Axis')
plt.show()
Drag options to blanks, or click blank then click option'
A'X Axis'
Bylabel
Ctitle
D'Scatter Plot'
Attempts:
3 left
💡 Hint
Common Mistakes
Using plt.title instead of plt.ylabel for y-axis label.
Not putting quotes around the axis label text.
5fill in blank
hard

Fill in the blanks to create a scatter plot with title and grid.

Matplotlib
plt.scatter(x, y)
plt.title([1])
plt.grid([2])
plt.show()
Drag options to blanks, or click blank then click option'
A'My Scatter Plot'
BTrue
CFalse
D'Scatter Data'
Attempts:
3 left
💡 Hint
Common Mistakes
Not using quotes for the title string.
Passing False to grid when you want to show grid lines.