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

Volume plots: axis ticks are overlapping #12974

Open
britta-wstnr opened this issue Nov 18, 2024 · 1 comment
Open

Volume plots: axis ticks are overlapping #12974

britta-wstnr opened this issue Nov 18, 2024 · 1 comment
Labels

Comments

@britta-wstnr
Copy link
Member

Description of the problem

When plotting source reconstruction results on volume MRIs, the axis labels are often mangled and overlap each other both on the colorbar but also on the y-axis of the time series plot.
Furthermore, the MRI seems and colorbar seem to be shifted relative to the black background. The axis values of the MRI are shifted, too.

Steps to reproduce

import mne
from mne.beamformer import make_lcmv, apply_lcmv

sample_path = mne.datasets.sample.data_path()
data_path = sample_path / 'MEG' / 'sample'
subjects_dir = sample_path / 'subjects'

# read raw data
fname_raw = data_path / 'sample_audvis_raw.fif'
raw = mne.io.read_raw_fif(fname_raw)
raw.pick(picks=['mag', 'stim'])

# make epochs
events = mne.find_events(raw)
epochs = mne.Epochs(raw, events, event_id=[3, 4])
evoked = epochs.average()

# load the precomputed MEG forward model from disk
fname_fwd = data_path / 'sample_audvis-meg-vol-7-fwd.fif'
fwd_meg = mne.read_forward_solution(fname_fwd)

# compute covariance matrix
data_cov = mne.compute_covariance(epochs, tmin=0.0, tmax=0.15, method='empirical')

# compute beamformer, apply, and plot
filters = make_lcmv(epochs.info, fwd_meg, data_cov=data_cov, pick_ori='max-power')
stc = apply_lcmv(evoked=evoked, filters=filters)
stc.crop(-0.05, 0.15).plot(subjects_dir=subjects_dir, subject='sample', src=fwd_meg['src']);

Link to data

No response

Expected results

A pretty plot 🙂

Actual results

image

Additional information

This has been confirmed to happen in Jupyter notebooks and from a plain script (see MWE, run inside VSCode). Problem has been reproduced by @drammock .

This was done in a fresh conda install of the latest release, 1.8.0

@larsoner
Copy link
Member

Ugh. I'm guessing this is due to some change in nilearn plotting.

It's also possible that somewhere we use blitting to update the plot for speed (?) and we could remove it. It would be slower but it would at least plot properly. Then once we have that working we could try reenabling blitting.

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

No branches or pull requests

2 participants