matplotlib / matplotlib/ipympl
MPL Event Handling Doc Example not fully functioning
Nobody has claimed this yet.
- Dominant language
- Jupyter Notebook
- Stars
- 1.7k
- Forks
- 234
- PR merge metrics
- No merged PRs in 30d
Description
I tried the example from the MPL event handling docs: a [bar chart with draggable bars](https://matplotlib.org/stable/users/event_handling.html#draggable-rectangle-exercise) ("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:
```python
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.

Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the draggable rectangle exercise from the MPL event handling documentation with JupyterLab 3.0.7 and ipympl 0.7.0, then compare it with QT5Agg. Trace the draw_artist and blit calls during dragging; done means the bars remain visible and draggable in the Jupyter environment.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- jupyter, python
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100