Skip to main content

plots.plot_region_bar

plots.plot_region_bar(
    ax,
    depths,
    atlas_ids,
    regions=None,
    show_labels=True,
    label_min_fraction=0.06,
    fontsize=8,
    title=None,
)

Draw brain regions as a coloured bar along the probe depth.

Each channel fills the depth range half-way to its neighbours, in its region’s colour. The acronym of a run of channels in one region is written inside the run, when the run is taller than label_min_fraction of the bar.

Args: ax (matplotlib.axes.Axes): Axes to draw on. Its x-axis is hidden. depths (np.ndarray): Depth of each channel along the probe (µm), in any order. atlas_ids (np.ndarray): Atlas id of each channel’s region, in the same order, in the region map to draw (remap Allen ids first, e.g. regions.remap). regions (iblatlas.regions.BrainRegions, optional): Region table for the colours and acronyms. Defaults to the iblatlas regions plus the decoders’ void_fluid. show_labels (bool, optional): Write the region acronyms. Defaults to True. label_min_fraction (float, optional): Smallest run, as a fraction of the bar height, that gets an acronym. Defaults to 0.06. fontsize (float, optional): Font size of the acronyms. Defaults to 8. title (str, optional): Axes title.

Returns: matplotlib.axes.Axes: The axes drawn on.

Raises: ValueError: If an atlas id is not in regions.