question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MPL Event Handling Doc Example not fully functioning

See original GitHub issue

I tried the example from the MPL event handling docs: a bar chart with draggable bars (“extra credit” version). This works fine in QT5Agg backend, but doesn’t fully work in Jupyter Lab (v3.0.7) with ipympl (v0.7.0). The plot displays fine, and I can see that click and drag events are being received by the widget, but during drag, the bars vanish. In fact, if in the click handler I include a color change:

        self.rect.set(animated=True,color='red')

Then I can see a faint red outline after the bar is “dropped” in the correct location (see below). So clearly the click/drag/release events are working, but the bar drawing during and after drag via draw_artist and blit are not.

image

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
ianhicommented, Apr 1, 2021

I think what you’re running into now is this issue from core matplotlib: https://github.com/matplotlib/matplotlib/issues/19116

Unfortunately no one has figured out a solution yet, your thoughts are of course welcome!

1reaction
jdtsmithcommented, Mar 31, 2021

Another bit of debugging. If I artificially limit movements to be relatively quite large (dropping all motion events that are “too small”), and move slowly it works just fine:

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Event handling and picking — Matplotlib 3.6.2 documentation
Event handling and picking#. Matplotlib works with a number of user interface toolkits (wxpython, tkinter, qt, gtk, and macosx) and in order to...
Read more >
Event handling and picking — Matplotlib 1.3.1 documentation
if picker is callable, it is a user supplied function which determines whether the artist is hit by the mouse event. The signature...
Read more >
How to regain control using mpl_disconnect() to end custom ...
I cannot get mpl_disconnect() to work in any situation I've tried. For illustration, I have this example from the Matplotlib documentation on event...
Read more >
mpl-events - PyPI
mpl -events provides high-level API, auto disconnecting and cleanup · Strings-based event types/names are not used. · Integer connection ...
Read more >
Event Handling Functions - Language Basics - MQL4 Reference
If other parameters, not corresponding to below descriptions, are specified for a corresponding function, or another return type is indicated for it, such...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found