Skip to content

BUG: stc plot color limits #8642

Closed

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

Activity

  1. kingjr commented on Dec 10, 2020

    @kingjr
    MemberAuthor

    cc @GuillaumeFavelier who probably know intimately the intricate 3d plotting functions

  2. added this to the 0.22 milestone on Dec 10, 2020
  3. larsoner commented on Dec 10, 2020

    @larsoner
    Member

    I can replicate on latest master, @GuillaumeFavelier I can make a quick PR for this since I just dumped #8335 (comment) on you :)

  4. NeuroLaunch commented on Dec 14, 2020

    @NeuroLaunch
    Contributor

    Nice catch, as I was just encountering this bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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