anyplotlib.PolygonWidget#
- class anyplotlib.PolygonWidget(push_fn, *, vertices, color='#00e5ff', linewidth=2, show_handles=True)[source]#
Bases:
WidgetDraggable polygon overlay widget for 2-D plots.
- Parameters:
push_fn (Callable) – Update callback.
vertices (list of tuple) – Polygon vertices
[(x0, y0), (x1, y1), ...]in pixel/data coordinates. Must have at least 3 vertices.color (str, optional) – CSS colour for the polygon outline. Default
"#00e5ff".linewidth (float, optional) – Outline stroke width in px. Default 2.
show_handles (bool, optional) – Draw the per-vertex grab handles. Default
True.
- Raises:
ValueError – If fewer than 3 vertices provided.