Skip to content

Conversation

@tsbinns
Copy link
Contributor

@tsbinns tsbinns commented Sep 16, 2024

Reference issue

Fixes #12852

What does this implement/fix?

Stops colorbar=False from being overwritten in plot_psds_topomap() (and also in e.g., *Spectrum.plot_topomap() which calls it).

Additional information

Also includes a small unit test to check the colorbar flag isn't ignored.

Copy link
Member

@drammock drammock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just one FYI / nitpick, I'll go ahead and merge since it's debatable if it's an improvement in this case.

Comment on lines +573 to +575
raw = read_raw_fif(raw_fname)
picks = pick_types(raw.info, meg="grad")
info = pick_info(raw.info, picks)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick/FYI]: there is mne.io.read_info(raw_fname) for cases where you don't need the actual raw data. Here you need picks too, so you'd also need mne.channel_indices_by_type() so in the end it's not any shorter:

Suggested change
raw = read_raw_fif(raw_fname)
picks = pick_types(raw.info, meg="grad")
info = pick_info(raw.info, picks)
info = read_info(raw_fname)
picks = channel_indices_by_type(info)["grad"]
info = pick_info(info, picks)

and you might need to add from mne.io import read_info and from mne import channel_indices_by_type to the top of the file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, will keep this in mind!

@drammock drammock merged commit 2cab025 into mne-tools:main Sep 18, 2024
@tsbinns tsbinns deleted the fix_topomap_cbar branch September 20, 2024 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

colorbar=False is ignored in plot_psds_topomap()

2 participants