Skip to content

BUG: stc plot color limits #8642

@kingjr

Description

@kingjr

@larsoner 000dac9 introduced a color limit bug in the stc plot

import numpy as np
from pathlib import Path
from mayavi import mlab
import matplotlib.pyplot as plt

import mne

data_path = Path(mne.datasets.sample.data_path())
fname = data_path / 'MEG' / 'sample' / 'sample_audvis-meg'

# Read stc from file
stc = mne.read_source_estimate(fname, subject='sample')
stc.data[:, :] = np.random.rand(*stc.data.shape) # some positive data


fig_size = (300, 300)
fig = mlab.figure(size=fig_size)

brain = stc.plot(
    hemi='lh',
    views='lat',
    colormap='coolwarm',
    subjects_dir=data_path / 'subjects',
    clim=dict(kind='value', pos_lims=[0, .2, .5]),  # <-------------------- this what breaks
    backend='mayavi',
    figure=fig,
)

img = mlab.screenshot(figure=fig, mode='rgba', antialiased=True)
plt.imshow(img)

before:
image

after:
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions