plot_annotated#
- tangles.util.ui.plot_annotated(x, y, annotation_x_positions, annotation_offsets, annotation_func: Callable[[float], ndarray] | Callable[[float], str], annotation_is_image: bool = False, annotation_zoom: float = 1, label: str = None, title: str = None, xlabel: str = None, ylabel: str = None, figsize: tuple[float, float] = (10, 5), ax: Axes | None = None, interactive: bool = False)#
A plot with annotations that can either be images or texts. Annotations can be provided by the caller through a callback function.
Parameters#
- xarraylike
x values to plot.
- yarraylike
y values to plot.
- annotation_x_positionsarraylike
x-values to be annotations (in units of the x-axis).
- annotation_offsetsarraylike
Array of 2-tuples. Each entry specifies the offset
(dx, dy)
of the annotation box from the annotation_x_positions (in pixels).- annotation_funcAnnotationFuncImg or AnnotationFuncTxt
Function that provides the content of the annotation box. The content can either be an image or a string. If you want to use a matplotlib.axes.Axes object see
wrap_annotation_func_ax()
.- annotation_is_imagebool
Pass True if annotation_func is of type AnnotationFuncImg.
- annotation_zoomfloat
Scaling applied to the annotations.
- labelstr
Label of the curve.
- titlestr
Title of the plot.
- xlabelstr
Label for the x-axis.
- ylabelstr
Label for the y-axis.
- figsize2-tuple of float
Figure size (if parameter ax is not present).
- axmatplotlib.Axes
The ax to plot into.
- interactivebool
If True, the plot is interactive and shows an annotation at the mouse position whenever the mouse is clicked or dragged.