vocalpy.plot.annot.segments#
- vocalpy.plot.annot.segments(onsets: ndarray[Any, dtype[_ScalarType_co]], offsets: ndarray[Any, dtype[_ScalarType_co]], lbl: ndarray[Any, dtype[_ScalarType_co]] | None, tlim: tuple | list | None = None, y_segments: float = 0.4, h_segments: float = 0.4, y_labels=0.3, ax: Axes | None = None, label_color_map: dict | None = None, text_kwargs: dict | None = None) tuple[list[Rectangle], list[Text] | None] [source]#
Plot segments on an axis.
Creates rectangles with the specified onsets and offsets all at height y_labels and places them on the axes ax. If labels are supplied, these are plotted in the rectangles.
- Parameters:
- onsetsnumpy.ndarray
Onset times of segments.
- offsetsnumpy.ndarray
Offset times of segments.
- lbllist, numpy.ndarray
Labels of segments.
- y_segmentsfloat, int
Height on y-axis at which segments should be plotted. Default is 0.4.
- h_segmentsfloat, int
Height of rectangles that represent segments. Default is 0.4.
- y_labelsfloat, int
Height on y-axis at which segment labels (if any) are plotted. Default is 0.4.
- axmatplotlib.axes.Axes
axes on which to plot segment. Default is None, in which case a new Axes instance is created
- label_color_mapdict, optional
A
dict
that maps string labels to colors (that are valid color arguments for matplotlib).- text_kwargsdict
Keyword arguments passed to the Axes.text method that plots the labels. Default is None.