Bird
0
0

What will happen if you run this code and move the mouse over the plot?

medium📝 Predict Output Q5 of 15
Matplotlib - Interactive Features
What will happen if you run this code and move the mouse over the plot?
import matplotlib.pyplot as plt
from matplotlib.widgets import Cursor

fig, ax = plt.subplots()
cursor = Cursor(ax, useblit=False, color='green', linewidth=2)
plt.show()
AAn error occurs because useblit=False is invalid
BNothing visible changes on the plot
CThe plot background color changes to green
DA green crosshair cursor follows the mouse pointer on the plot
Step-by-Step Solution
Solution:
  1. Step 1: Understand Cursor behavior with useblit=False

    Setting useblit=False disables fast drawing but still shows the cursor crosshair following the mouse pointer.
  2. Step 2: Eliminate other options

    No error occurs with useblit=False, and the plot background does not change color.
  3. Final Answer:

    A green crosshair cursor follows the mouse pointer on the plot -> Option D
  4. Quick Check:

    Cursor shows crosshair even with useblit=False [OK]
Quick Trick: Cursor crosshair shows regardless of useblit setting [OK]
Common Mistakes:
  • Thinking useblit=False causes errors
  • Expecting no cursor with useblit=False
  • Confusing cursor color with background color

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Matplotlib Quizzes