matplotlib / matplotlib/ipympl

ipympl 0.8.2 - ginput() does not work on Jupyterlab / returns an empty array

Open
#400 1 comment 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 bug**
I should be able to select data points from a figure and then red crosses are supposed to appear after clicking with the mouse, but nothing happens, an empty array is returned and the figures only appear after the timeout of ginput().

**Expected behavior**
Figure pops up and I can click with the mouse on the figure to select data points. An array will be generated

**To Reproduce**

```
%matplotlib widget

import matplotlib.pyplot as plt
import numpy as np
t = np.arange(10)

plt.plot(t, np.sin(t))

plt.title('matplotlib.pyplot.ginput()\
function Example', fontweight ="bold")

print("After 3 clicks :")
x = plt.ginput(3)
print(x)

plt.show()

```
**My Platform**

Firefox on Arch Linux, latest version after system update.
I tested it on Jupyterlab, I did not test it on Jupyter-notebook.

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 by running the issue's minimal reproduction with the `%matplotlib widget` backend in JupyterLab on Firefox. Investigate why `plt.ginput(3)` returns an empty array and the figure appears only after the timeout; done means mouse clicks produce the expected coordinates and red cross markers.

Written by the indexing model from the issue text.

Assessment

Tech stack
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.