Colorbar labels overlap in Brain plot without time viewer

Open
#10,131 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python

Research direction

Start by running the provided Python reproducer with mne.viz.set_3d_backend('pyvistaqt') and stc.plot(time_viewer=False, size=(300, 300)). Inspect the colorbar used by the Brain plot and verify the result at a small window size; done means the displayed labels no longer overlap while the anchor and midpoint labels remain readable.

Written by the indexing model from the issue text.

Description

BUG VIZ

When plotting an STC without the time viewer, the colorbar is arranged horizontally, causing the individual labels to overlap depending on the window size:

# %%
from pathlib import Path
import mne

mne.viz.set_3d_backend('pyvistaqt')
sample_dir = Path(mne.datasets.sample.data_path())
stc_fname = sample_dir / 'MEG' / 'sample' / 'sample_audvis-meg'  # omit suffix
fs_subject = 'sample'
fs_subjects_dir = sample_dir / 'subjects'

stc = mne.read_source_estimate(fname=stc_fname, subject=fs_subject)

stc.plot(
    time_viewer=False,
    size=(300, 300),
    subjects_dir=fs_subjects_dir
)
Screen Shot 2021-12-14 at 17 48 16

I'd suggest to only label the anchors and midpoint.

cc @GuillaumeFavelier

❯ mne sys_info
Platform:       macOS-12.1-x86_64-i386-64bit
Python:         3.9.7 | packaged by conda-forge | (default, Sep 29 2021, 20:33:18)  [Clang 11.1.0 ]
Executable:     /Users/hoechenberger/miniforge3/envs/mne/bin/python3.9
CPU:            i386: 8 cores
Memory:         16.0 GB

mne:            1.0.dev0
numpy:          1.21.4 {blas=NO_ATLAS_INFO, lapack=lapack}
scipy:          1.7.3
matplotlib:     3.5.0 {backend=MacOSX}

sklearn:        1.0.1
numba:          0.53.1
nibabel:        3.2.1
nilearn:        0.8.1
dipy:           1.4.1
cupy:           Not found
pandas:         1.3.4
pyvista:        0.32.1 {OpenGL 4.1 INTEL-18.3.5 via Intel(R) Iris(TM) Plus Graphics OpenGL Engine}
pyvistaqt:      0.5.0
ipyvtklink:     0.2.1
vtk:            9.0.3
PyQt5:          5.12.3
ipympl:         0.8.2
mne_qt_browser: 0.1.7
pooch:          v1.5.2
Dominant language
Python
Stars
3.5k
Forks
1.6k
Avg merge
1d 6h
Merged PRs (30d)
100

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from mne-tools/mne-python

All issues in mne-tools/mne-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.