utils

plot.utils

Functions

Name Description
extract_svg_colors Extracts colors from an SVG file and returns them as a list of hex codes.
get_cmap Get a ListedColormap from given colors (defaults to tvb_colors_simple).
get_continuous_cmap Get a continuous LinearSegmentedColormap from a list of hex codes.
get_logo Retrieve the TVB-O logo as a NumPy image array.
hex2rgba Convert a hex color code to RGBA.
multiview Display multiple views of brain regions.

extract_svg_colors

plot.utils.extract_svg_colors(svg_path)

Extracts colors from an SVG file and returns them as a list of hex codes.

get_cmap

plot.utils.get_cmap(colors=None)

Get a ListedColormap from given colors (defaults to tvb_colors_simple).

Parameters

colors : list, optional List of colors.

Returns

ListedColormap

get_continuous_cmap

plot.utils.get_continuous_cmap(hex_list, float_list=None)

Get a continuous LinearSegmentedColormap from a list of hex codes.

Parameters

hex_list : list List of hex code strings. float_list : list, optional List of floats between 0 and 1 of the same length as hex_list.

Returns

LinearSegmentedColormap

hex2rgba

plot.utils.hex2rgba(hex, alpha=1, max=1)

Convert a hex color code to RGBA.

Parameters

Name Type Description Default
hex str Hexadecimal color code. required
alpha int Alpha value for the color. Defaults to 1. 1
max int Scaling factor. Defaults to 1. 1

Returns

Name Type Description
tuple RGBA tuple.

multiview

plot.utils.multiview(data, cortex, suptitle='', figsize=(15, 10), **kwds)

Display multiple views of brain regions.

Adapted from https://github.com/the-virtual-brain/tvb-root/blob/master/tvb_documentation/tutorials/utils.py

Parameters

data : ndarray Data for the regions. cortex : Cortex Brain cortex information. suptitle : str, optional Super title for the plots. figsize : tuple, optional Figure size.