mne-python icon indicating copy to clipboard operation
mne-python copied to clipboard

`mne.viz.plot_source_estimates` docs incorrectly say `colormap` can be supplied as an `ndarray`

Open caiw opened this issue 10 months ago • 2 comments

Proposed documentation enhancement

The docs on the website include:

colormap : str | np.ndarray of float, shape(n_colors, 3 | 4)

  • Name of colormap to use or a custom look up table. If array, must be (n x 3) or (n x 4) array for with RGB or RGBA values between 0 and 255. The default (‘auto’) uses 'hot' for one-sided data and ‘mne’ for two-sided data.

But then in _process_clim there is a call to _validate_type(colormap, (str, Colormap), "colormap"), which throws an error if an ndarray is supplied.

caiw avatar Apr 04 '25 14:04 caiw

Hello! 👋 Thanks for opening your first issue here! ❤️ We will try to get back to you soon. 🚴

welcome[bot] avatar Apr 04 '25 14:04 welcome[bot]

I think in this case it's probably best to update the documentation, and maybe somewhere link to ListedColormap to show people how to easily go from an ndarray to a colormap.

Or we could add support to do this, it would in theory only be a few lines since ListedColormap should do all the sanity checking when passed an ndarray I think...

larsoner avatar Apr 04 '25 14:04 larsoner