Complete the code to import the matplotlib pyplot module as plt.
import matplotlib.[1] as plt
We import the plotting module from matplotlib as pyplot and alias it as plt.
Complete the code to create a simple plot of y versus x.
plt.plot(x, [1])
plt.show()The plot function plots y-values against x-values. So, y is the second argument.
Fix the error in the annotation code by completing the missing parameter name.
plt.annotate('Point', xy=(2, 3), xytext=(3, 4), arrowprops=[1]) plt.show()
The correct parameter for arrow style in arrowprops is arrowstyle.
Fill both blanks to create an annotation with an arrow pointing from text to a point.
plt.annotate('Label', xy=[1], xytext=[2], arrowprops={'arrowstyle': '->'}) plt.show()
The arrow points from the text location xytext=(3,4) to the point xy=(2,3).
Complete the code to create a dictionary comprehension that maps points to their labels only if x > 2.
labels = {point: label for point, label in points.items() if point[0] [1] 2}The dictionary comprehension uses the point as key and label as value with no extra syntax between them, filtering points where x > 2.