Skip to content

Legend colors misbehave on plot_evoked_topo #11258

@teekuningas

Description

@teekuningas

Description of the problem

For some reason the procedure I've been using for years to plot multiple evokeds using plot_evoked_topo produces a misbehaving legend.

Steps to reproduce

import mne

path = str(mne.datasets.sample.data_path()) + '/MEG/sample/sample_audvis_raw.fif'
raw = mne.io.read_raw_fif(path)

events_1 = mne.find_events(raw)
epochs_1 = mne.Epochs(raw, events_1, event_id={'LH': 1})
evoked_1 = epochs_1.average()

events_2 = mne.find_events(raw)
epochs_2 = mne.Epochs(raw, events_2, event_id={'RH': 2})
evoked_2 = epochs_2.average()

mne.viz.plot_evoked_topo([evoked_1, evoked_2])

Link to data

No response

Expected results

Legend should have two lines that have matching colors to texts.

Actual results

See:

image

Additional information

Platform: Linux-4.18.0-305.19.1.el8_4.x86_64-x86_64-with-glibc2.35
Python: 3.9.13 (main, May 17 2022, 14:19:07) [GCC 11.3.0]
Executable: /nix/store/32iyr06f5v32zcglrn4d4jwggy0gslg1-python3-3.9.13/bin/python3
CPU: : 8 cores
Memory: Unavailable (requires "psutil" package)
mne: 1.2.0
numpy: 1.23.1 {unknown linalg bindings}
scipy: 1.8.1
matplotlib: 3.5.2 {backend=QtAgg}

sklearn: 1.1.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