Complete the code to import the mplcursors library.
import [1]
mplcursors is the library used to add interactive hover labels in matplotlib plots.
Complete the code to create a scatter plot with matplotlib.
fig, ax = plt.subplots()
ax.[1](x, y)Scatter plots are created with the scatter() method in matplotlib.
Fix the error in the code to enable hover labels using mplcursors.
cursor = mplcursors.[1](ax.collections)The correct function to create interactive cursors is mplcursors.cursor().
Fill both blanks to add a custom label format for the hover labels.
cursor.connect("add", lambda sel: sel.annotation.set_text(f"X: {sel.target[[1]]:.2f}\nY: {sel.target[[2]]:.2f}"))
The x and y coordinates are at index 0 and 1 in sel.target respectively.
Fill all three blanks to create a dictionary comprehension that maps points to their labels with conditions.
labels = { [1]: f"Point {x}" for x in points if x[[2]] [3] 0 }The dictionary keys are points (x), filtering points where y (index 1) is greater than 0.
