Mne-python: BUG: stc plot color limits

Created on 10 Dec 2020  路  3Comments  路  Source: mne-tools/mne-python

@larsoner 000dac95c0f7a4439ee60fb92f1007fd288f9611 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

BUG

Most helpful comment

I can replicate on latest master, @GuillaumeFavelier I can make a quick PR for this since I just dumped https://github.com/mne-tools/mne-python/pull/8335#issuecomment-742531087 on you :)

All 3 comments

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

I can replicate on latest master, @GuillaumeFavelier I can make a quick PR for this since I just dumped https://github.com/mne-tools/mne-python/pull/8335#issuecomment-742531087 on you :)

Nice catch, as I was just encountering this bug.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kingjr picture kingjr  路  35Comments

cbrnr picture cbrnr  路  34Comments

mmagnuski picture mmagnuski  路  43Comments

rob-luke picture rob-luke  路  51Comments

kingjr picture kingjr  路  66Comments