0
0
Matplotlibdata~10 mins

Why Matplotlib for data visualization - 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 whole matplotlib instead of pyplot.
Importing unrelated libraries like numpy or pandas.
2fill in blank
medium

Complete the code to create a simple line plot using Matplotlib.

Matplotlib
plt.[1]([1, 2, 3], [4, 5, 6])
plt.show()
Drag options to blanks, or click blank then click option'
Aplot
Bbar
Chist
Dscatter
Attempts:
3 left
💡 Hint
Common Mistakes
Using bar or hist which create different chart types.
Using scatter which plots points without connecting lines.
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'
Aylabel
Bxlabel
Ctitle
Dlegend
Attempts:
3 left
💡 Hint
Common Mistakes
Using xlabel or ylabel which label axes, not the title.
Using legend which adds a legend, not a title.
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 axis labels and a title.

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