|
15 | 15 |
|
16 | 16 | from . import utils, io
|
17 | 17 | from .config import config
|
18 |
| -from .utils import Surface, verbose, _get_subjects_dir |
| 18 | +from .utils import Surface, verbose, create_color_lut, _get_subjects_dir |
19 | 19 |
|
20 | 20 |
|
21 | 21 | import logging
|
@@ -757,7 +757,7 @@ def add_overlay(self, source, min=None, max=None, sign="abs", name=None,
|
757 | 757 | self._toggle_render(True, views)
|
758 | 758 |
|
759 | 759 | def add_data(self, array, min=None, max=None, thresh=None,
|
760 |
| - colormap="blue-red", alpha=1, |
| 760 | + colormap="RdBu_r", alpha=1, |
761 | 761 | vertices=None, smoothing_steps=20, time=None,
|
762 | 762 | time_label="time index=%d", colorbar=True,
|
763 | 763 | hemi=None):
|
@@ -788,10 +788,10 @@ def add_data(self, array, min=None, max=None, thresh=None,
|
788 | 788 | max value in colormap (uses real max if None)
|
789 | 789 | thresh : None or float
|
790 | 790 | if not None, values below thresh will not be visible
|
791 |
| - colormap : str | array [256x4] |
792 |
| - name of Mayavi colormap to use, or a custom look up table (a 256x4 |
793 |
| - array, with the columns representing RGBA (red, green, blue, alpha) |
794 |
| - coded with integers going from 0 to 255). |
| 791 | + colormap : string, list of colors, or array |
| 792 | + name of matplotlib colormap to use, a list of matplotlib colors, |
| 793 | + or a custom look up table (an n x 4 array coded with RBGA values |
| 794 | + between 0 and 255). |
795 | 795 | alpha : float in [0, 1]
|
796 | 796 | alpha level to control opacity
|
797 | 797 | vertices : numpy array
|
@@ -841,16 +841,9 @@ def add_data(self, array, min=None, max=None, thresh=None,
|
841 | 841 | # Copy and byteswap to deal with Mayavi bug
|
842 | 842 | mlab_plot = _prepare_data(array_plot)
|
843 | 843 |
|
844 |
| - # process colormap argument |
845 |
| - if isinstance(colormap, basestring): |
846 |
| - lut = None |
847 |
| - else: |
848 |
| - lut = np.asarray(colormap) |
849 |
| - if lut.shape != (256, 4): |
850 |
| - err = ("colormap argument must be mayavi colormap (string) or" |
851 |
| - " look up table (array of shape (256, 4))") |
852 |
| - raise ValueError(err) |
853 |
| - colormap = "blue-red" |
| 844 | + # Process colormap argument into a lut |
| 845 | + lut = create_color_lut(colormap) |
| 846 | + colormap = "Greys" |
854 | 847 |
|
855 | 848 | data = dict(array=array, smoothing_steps=smoothing_steps,
|
856 | 849 | fmin=min, fmid=(min + max) / 2, fmax=max,
|
|
0 commit comments