Skip to content

Deleting annotation in raw.plot() does not work #11487

@cbrnr

Description

@cbrnr

Description of the problem

When deleting an annotation in raw.plot() with a right-click, a residual annotation (with duration around zero) remains right where the mouse was clicked.

Steps to reproduce

import mne

folder = mne.datasets.sample.data_path()
file = folder / "MEG" / "sample" / "sample_audvis_raw.fif"
raw = mne.io.read_raw_fif(file)

raw.plot()

Expected results

The annotation should be completely removed.

Actual results

A very short annotation remains.

Screen.Recording.2023-02-16.at.15.39.27.mov

I also get this error message in the console, not sure if it is related (seems likely though):

Traceback (most recent call last):
  File "/Users/clemens/Projects/mne-python/.direnv/python-3.10.10/lib/python3.10/site-packages/matplotlib/cbook/__init__.py", line 307, in process
    func(*args, **kwargs)
  File "/Users/clemens/Projects/mne-python/mne/viz/_mpl_figure.py", line 187, in _close
    super()._close(event)
  File "/Users/clemens/Projects/mne-python/mne/viz/_mpl_figure.py", line 111, in _close
    self.mne.parent_fig.mne.child_figs.remove(self)
ValueError: list.remove(x): x not in list

Additional information

Details
Platform:         macOS-11.7.4-x86_64-i386-64bit
Python:           3.10.10 (main, Feb  8 2023, 05:44:44) [Clang 13.0.0 (clang-1300.0.29.30)]
Executable:       /Users/clemens/Projects/mne-python/.direnv/python-3.10.10/bin/python
CPU:              i386: 8 cores
Memory:           Unavailable (requires "psutil" package)
mne:              1.4.dev0
numpy:            1.24.2 {OpenBLAS 0.3.21 with 4 threads}
scipy:            1.10.0
matplotlib:       3.6.3 {backend=MacOSX}
sklearn:          1.2.1
numba:            Not found
nibabel:          Not found
nilearn:          Not found
dipy:             Not found
openmeeg:         Not found
cupy:             Not found
pandas:           Not found
pyvista:          Not found
pyvistaqt:        Not found
ipyvtklink:       Not found
vtk:              Not found
qtpy:             Not found
ipympl:           Not found
pyqtgraph:        Not found
pooch:            v1.6.0
mne_bids:         Not found
mne_nirs:         Not found
mne_features:     Not found
mne_qt_browser:   Not found
mne_connectivity: Not found
mne_icalabel:     Not found

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions