rsatoolbox.vis.colors module¶
Classic colormap ported from matlab rsatoolbox
@author: iancharest
- rsatoolbox.vis.colors.color_scale(n_cols: int, anchor_cols=None, monitor=False)[source]¶
linearly interpolates between a set of given anchor colours to give n_cols and displays them if monitor is set
- Parameters:
n_cols (int) – number of colors for the colormap
anchor_cols (numpy.ndarray, optional) – what color space to interpolate. Defaults to None.
monitor (boolean, optional) – quick visualisation of the resulting colormap. Defaults to False.
- Returns:
n_cols x 3 RGB array.
- Return type:
numpy.ndarray
- rsatoolbox.vis.colors.rdm_colormap_classic(n_cols: int = 256, monitor: bool = False)[source]¶
this function provides a convenient colormap for visualizing dissimilarity matrices. it goes from blue to yellow and has grey for intermediate values.
- Parameters:
n_cols (int, optional) – precision of the colormap.
256. (Defaults to) –
- Returns:
this matplotlib color object can be used as a cmap in any plot.
- Return type:
[matplotlib ListedColormap]
Example
import numpy as np import matplotlib.pyplot as plt from rsatoolbox.vis.colors import rdm_colormap_classic plt.imshow(np.random.rand(10,10),cmap=rdm_colormap_classic()) plt.colorbar() plt.show()
(ported from Niko Kriegeskorte’s RDMcolormap.m)