Skip to main content

plots.plot_features_heatmap

plots.plot_features_heatmap(
    values,
    depths,
    features,
    ax,
    feature_groups=None,
    vmin=-2,
    vmax=2,
    cmap='RdBu_r',
    show_feature_names=True,
    show_group_labels=True,
    show_group_separators=True,
    fontsize=8,
)

Draw the features of one probe as an image: channels sorted by depth, one column each.

Args: values (np.ndarray): Feature values, shape (n_channels, n_features), typically z-scored. Rows in any order. depths (np.ndarray): Depth of each channel along the probe (µm), in the row order. features (list[str]): Feature names, in the column order of values. ax (matplotlib.axes.Axes): Axes to draw on. feature_groups (dict[str, list[str]], optional): Named groups of features, e.g. {"LF": [...], "AP": [...]}. Concatenated, they must equal features. vmin (float, optional): Lower end of the colour range. Defaults to -2. vmax (float, optional): Upper end of the colour range. Defaults to 2. cmap (str, optional): Matplotlib colormap name. Defaults to “RdBu_r”. show_feature_names (bool, optional): Name each column. Defaults to True. show_group_labels (bool, optional): Name each group above the image. Defaults to True. show_group_separators (bool, optional): Draw a white line between groups. Defaults to True. fontsize (float, optional): Font size of the feature names. Defaults to 8.

Returns: matplotlib.image.AxesImage: The image, e.g. for a colorbar.

Raises: ValueError: If feature_groups does not list features in order.