matplotlib / matplotlib/ipympl

PolygonSelector does not work in JupyterLab

Open
#476 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jupyter Notebook
Stars
1.7k
Forks
234
PR merge metrics
No merged PRs in 30d

Description

## Describe the issue

The PolygonSelector example from the [mpl docs](https://matplotlib.org/stable/gallery/widgets/polygon_selector_demo.html) works very well in the default Qt backend.
![Screenshot at 2022-07-05 17-01-56](https://user-images.githubusercontent.com/39047984/177358796-a0c848f6-27d9-48e0-935c-0e6c9427da30.png)

However, using `ipympl` in a notebook, nothing happens. No gray point follows the mouse cursor, nothing is drawn when I click. Just the initial figure with the blue dots.
I checked the jupyterlab log console on debug level but there are no errors.

I was wondering if it was related to https://github.com/matplotlib/matplotlib/issues/15852, and tried adding `useblit=False` where the `PolygonSelector` is created, but this did not help.

## Versions

- jupyterlab = 3.4.2
- ipympl = 0.9.1
- matplotlib = 3.5.2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the PolygonSelector example linked in the Matplotlib documentation and reproduce it with ipympl in JupyterLab 3.4.2. Compare the working Qt backend with the notebook behavior, including the attempted useblit=False setting. Done means the gray cursor point and polygon drawing respond to mouse interaction in the notebook.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter, jupyter-notebook
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.