You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Deleting annotation in raw.plot() does not work #11487
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.
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
It looks like it's because in the legacy matplotlib backend you can define an annotation either with the left click or with the right click. However, I don't get any error traceback in the console.
Also, interestingly, if you do left click first on the created annotation and then right-click it will delete it without creating a new short annotations where you right clicked.
EDIT: I do get the traceback in the console if I don't close first the "annotation" pop-up, regardless of the deletion of an annotation.
Thanks for investigating @mscheltienne! I don't think creating an annotation with a right click is intended (or is it?). I thought it was mapped to the green line which indicates the time under the mouse cursor.
agree that right-click is not supposed to create annotations. In non-annotation mode it clears the green line (left-click sets it), in annotation mode it's supposed to clear an annotation (left-drag creates it).
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
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):
Additional information
Details