Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Viz: evoked.plot_image with the group_by parameter produces faulty sub-panel titles. #10608

Closed
sappelhoff opened this issue May 6, 2022 · 4 comments · Fixed by #10618
Closed
Labels
Milestone

Comments

@sappelhoff
Copy link
Member

Describe the bug

evoked.plot_image with the group_by parameter produces faulty sub-panel titles.

Steps to reproduce

import mne

path = mne.datasets.eegbci.load_data(1, 1)[0]

raw = mne.io.read_raw_edf(path)
mne.datasets.eegbci.standardize(raw)
raw.set_montage("standard_1005")

epochs = mne.make_fixed_length_epochs(raw)
evoked = epochs.average()

sel = mne.channels.make_1020_channel_selections(evoked.info)

fig, axs = plt.subplots(3, 1)
axes = {sel: ax for sel, ax in zip(sel, axs.ravel())}
evoked.plot_image(group_by=sel, axes=axes, show=False)
fig.tight_layout()

Expected results

A plot with 3 sub-panels. the titles should be "Left", "Midline", "Right" ... pretty much as here: https://mne.tools/stable/auto_examples/visualization/roi_erpimage_by_rt.html#sphx-glr-auto-examples-visualization-roi-erpimage-by-rt-py

Actual results

All sub-panels have the title "Left"

image

This is also the case here: https://mne.tools/stable/auto_tutorials/stats-sensor-space/20_erp_stats.html

Additional information

happens on mne CI in main branch (2022-05-06)

@sappelhoff sappelhoff added the BUG label May 6, 2022
@sappelhoff
Copy link
Member Author

I believe the error resides somewhere here:

titles = ({channel_type(evoked.info, idx): sel
for idx in group_by[sel]} if titles is None else titles)

@hoechenberger
Copy link
Member

Cool, can you triple-check it's really just the labels that are wrong, or if there's maybe even an issue with the displayed data?

@hoechenberger
Copy link
Member

Also for EEG, I don't believe a "channel index" on the Y axis is helping anyone looking at this plot…

@sappelhoff
Copy link
Member Author

Judging from my plots, the data is displayed correctly.

Also for EEG, I don't believe a "channel index" on the Y axis is helping anyone looking at this plot…

you can pass show_names="all" to fix this (see API), but then you have to make the axes bigger as well (or tick label font smaller), else the channel labels overlap by too much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants