[ENH]: Remove `canvas.draw` from `widgets.Cursor.onmove` · Issue #26901 · matplotlib/matplotlib · GitHub
Skip to content

[ENH]: Remove canvas.draw from widgets.Cursor.onmove #26901

Description

@komoto48g

Problem

A busy icon appears every time the mouse goes off the axes and the cursor is cleared.
For image files ~100MB, the busy icon lasts 1-2 seconds each time.

Sample code:

from matplotlib.widgets import Cursor
from matplotlib import pyplot as plt
from matplotlib import cm
from PIL import Image

fig, ax = plt.subplots()

img = Image.open(r"Path to large image file ~100MB")
ax.imshow(img, cmap=cm.gray)

cursor = Cursor(ax, useblit=True, color='red', linewidth=1)

plt.show()

Proposed solution

I think the behavior of not clearing the cursor when the mouse goes off the axes is acceptable.
It is also consistent with the behavior of the similar class MultiCursor which doesn't call canvas.draw.

If accepted, the following lines can be removed and needclear will also be removed:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions