Matplotlib Flashcards
1
Q
How do you import matplotlib?
A
import matplotlib.pyplot as plt
2
Q
What is the basic function to plot?
A
plt.plot()
3
Q
How would you adjust the axis of your plot?
A
plt.axis()
4
Q
What is the function to add a title?
A
plt.title(“My title”)
5
Q
How would you add or change the x and y labels?
A
plt.xlabel(“This is my x label”), plt.ylabel(“Y label”)
6
Q
Plot a histogram
A
plt.hist()
7
Q
Plot a scatter plot
A
plt.scatter()
8
Q
Plot a pie chart
A
plt.pie()
9
Q
How would you add a legend?
A
plt.legend()
10
Q
Provide three features that you can change in your plots:
A
bins, width, color, shape