visbrain.objects.SourceObj.color_sources

SourceObj.color_sources(analysis=None, color_by=None, data=None, roi_to_color=None, color_others='black', hide_others=False, cmap='viridis', clim=None, vmin=None, vmax=None, under='gray', over='red')[source][source]

Custom color sources methods.

This method can be used to color sources :

  • According to a data vector. In that case, source’s colors are inferred using colormap inputs (i.e cmap, vmin, vmax, clim, under and over)
  • According to ROI analysis (using the analysis and color_by input parameters)
Parameters:
data : array_like | None

A vector of data with the same length as the number os sources. The color is inferred from this data vector and can be controlled using the cmap, clim, vmin, vmax, under and over parameters.

analysis : pandas.DataFrames | None

ROI analysis runned using the analyse_sources method.

color_by : string | None

A column name of the analysis DataFrames. This columns is then used to identify the color to set to each source inside ROI.

roi_to_color : dict | None

Define custom colors to ROI. For example use {‘BA4’: ‘red’, ‘BA32’: ‘blue’} to define custom colors. If roi_to_color is None, random colors will be used instead.

color_others : array_like/tuple/string | ‘black’

Specify how to color sources that are not found using the roi_to_color dictionary.

hide_others : bool | False

Show or hide sources that are not found using the roi_to_color dictionary.