-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
MRG, VIZ: Fix title position in plot_sensors #8752
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
Conversation
hoechenberger
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Care to add a changelog entry? :)
|
@drammock feel free to review and merge when you're happy since you've been working in the |
Me likes!! 😍 |
b31b742 to
67fb952
Compare
There is a downside to this, in that window titles don't show up in our tutorial docs. We're not super consistent about this throughout the codebase, but I've been leaning toward using the plot title for generic descriptive stuff like "Power spectral density (magnetometers)" or "sensor positions", and using the window title for the information that is more useful interactively (esp. during preprocessing), like the subject ID. On that basis, I would lean toward leaving this as a plot title rather than a window title. On the other hand, sensor location plots often get inset into data plots, so it might simplify things to not add axes titles to them by default? In which case putting that info in a window title makes sense (as long as we're careful that it doesn't change the window title when the sensor plot is merely an inset). |
|
In general I agree, but in this case the title "Sensor positions (eeg)" really doesn't contain a lot of helpful information and takes up a lot of space. Either way, let me know how to proceed. |
I think this reasoning wins out for me. Just reading the code, I think currently it will change the figure title even when the sensor plot is merely an inset axes.... yep, just tested with this: import os
import mne
import matplotlib.pyplot as plt
plt.ion()
fig, ax = plt.subplots()
inax = ax.inset_axes((0.1, 0.1, 0.4, 0.4))
dp = mne.datasets.multimodal.data_path()
raw = mne.io.read_raw(os.path.join(dp, 'multimodal_raw.fif'))
mne.viz.plot_sensors(raw.info, axes=inax) |
|
Is there a way to check whether the axes are the sole axes in a figure or if they are inset? |
I don't think so... I think EDIT: it would be possible to check the length of |
|
@drammock I think this should work now - can you check? |
Co-authored-by: Daniel McCloy <dan@mccloy.info>
|
@drammock done! |
|
thanks @cbrnr! |
* upstream/master: (66 commits) MRG, ENH: Add infant template downloader (mne-tools#8738) ENH: add reader for NeuroElectrics .nedf files (mne-tools#8734) DOC: improve glossary entry about fiducials (mne-tools#8763) MRG, ENH: Add Report.add_custom_css (mne-tools#8762) BUG, DOC: read_raw_egi didn't support pathlib.Path; update read_raw() docstring (mne-tools#8759) Add "dbs" as new channel type (mne-tools#8739) MRG, VIZ: Fix title position in plot_sensors (mne-tools#8752) MRG: Support for non-FIFF files in Report.parse_folder (mne-tools#8744) MRG, VIZ, FIX: sEEG picking in _prepare_topomap_plot() (mne-tools#8736) DOC: don't use single letter variable name in _compute_forward (mne-tools#8727) WIP: Fix search [skip github] [skip azp] (mne-tools#8742) WIP: Compare Beer-lambert to HOMER (mne-tools#8711) MRG: bump spyder version (mne-tools#8020) FIX anon with IO round trip (mne-tools#8731) fix set_bipolar_reference for Epochs (mne-tools#8728) WIP: Add width argument, reduce default (mne-tools#8725) ENH: Add toggle-all button to Report (mne-tools#8723) fix int/float conversion in nicolet header (mne-tools#8712) MRG, BUG: Fix Report.add_bem_to_section n_jobs != 1 (mne-tools#8713) MRG, DOC: Make "rank" options in docs more accessible (mne-tools#8707) ...

The title is out of bounds in figures created by
plot_sensors(includingmontage.plot()).Before:

After:
