Bird
0
0
Raspberry Piprogramming~5 mins

Matplotlib for data visualization in Raspberry Pi - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is Matplotlib used for in data science?
Matplotlib is a tool to create pictures from data. It helps us see patterns and understand numbers by drawing charts and graphs.
Click to reveal answer
beginner
How do you create a simple line chart using Matplotlib?
You use the plot() function to draw lines. For example, plt.plot([1, 2, 3], [4, 5, 6]) draws a line connecting points (1,4), (2,5), and (3,6).
Click to reveal answer
beginner
What does plt.show() do in Matplotlib?
It opens a window to display the chart you made. Without plt.show(), the picture might not appear.
Click to reveal answer
beginner
How can you add a title and labels to your Matplotlib chart?
Use plt.title('Title') for the chart title, plt.xlabel('X label') for the x-axis, and plt.ylabel('Y label') for the y-axis.
Click to reveal answer
beginner
What is the difference between plt.plot() and plt.bar()?
plt.plot() draws lines connecting points, good for trends. plt.bar() draws bars, good for comparing amounts.
Click to reveal answer
Which Matplotlib function is used to display the final plot?
Aplt.show()
Bplt.draw()
Cplt.plot()
Dplt.display()
What type of chart does plt.bar() create?
APie chart
BLine chart
CScatter plot
DBar chart
How do you add a label to the x-axis in Matplotlib?
Aplt.xaxis('label')
Bplt.xlabel('label')
Cplt.labelx('label')
Dplt.axislabel('label')
Which command draws a line connecting points (1,2), (2,3), and (3,4)?
Aplt.plot([1, 2, 3], [2, 3, 4])
Bplt.bar([1, 2, 3], [2, 3, 4])
Cplt.scatter([1, 2, 3], [2, 3, 4])
Dplt.line([1, 2, 3], [2, 3, 4])
What is the first step to use Matplotlib in your Python code?
ACreate a plot with <code>plt.plot()</code>
BCall <code>plt.show()</code>
CImport Matplotlib with <code>import matplotlib.pyplot as plt</code>
DSave the plot with <code>plt.save()</code>
Explain how to create and display a simple line chart using Matplotlib.
Think about the steps from importing to showing the chart.
You got /3 concepts.
    Describe how to add a title and axis labels to a Matplotlib chart and why it is important.
    Labels tell us what the chart and axes mean.
    You got /4 concepts.