Skip to content

Multicursor disappears when not moving on nbagg with useblit=False + burns CPU #19633

Closed
@ianhi

Description

@ianhi

Bug report

Bug summary
When on the nbagg backend if you stop moving the mouse the multicursor will disappear. The same example works fine on the qt backend.

Additionally I noticed that when I add the multicursor my cpu usage jumps and the kernel busy indicator constantly flashes on and off.

Showing the plot without the multicursor:
image
and with the multicursor (just displaying, not interacting with the plot):

image
That usage is pretty stable and my laptop's fan goes wild.

The issue with the dissappearing was originally noticed by @ipcoder in matplotlib/ipympl#306

Code for reproduction

%matplotlib nbagg
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.widgets import MultiCursor

t = np.arange(0.0, 2.0, 0.01)
s1 = np.sin(2*np.pi*t)
s2 = np.sin(4*np.pi*t)

fig, (ax1, ax2) = plt.subplots(2, sharex=True)
ax1.plot(t, s1)
ax2.plot(t, s2)

multi = MultiCursor(fig.canvas, (ax1, ax2), color='r', lw=1, useblit=False)
plt.show()

Actual outcome

Peek 2021-03-03 18-12

and the high CPU usage

Expected outcome
Red line doesn't disappear + my CPU doesn't get crushed.

Matplotlib version

  • Operating system: Ubuntu
  • Matplotlib version (import matplotlib; print(matplotlib.__version__)): '3.3.4.post2456+gfd23bb238'
  • Matplotlib backend (print(matplotlib.get_backend())): nbagg
  • Python version: '3.9.1 | packaged by conda-forge | (default, Jan 26 2021, 01:34:10) \n[GCC 9.3.0]'
  • Jupyter version (if applicable): Notebook 6.2.0 - IPython 7.20.0

dev instlal of maptlotlib + conda-forge for the others

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions