anyplotlib.PolygonWidget#

class anyplotlib.PolygonWidget(push_fn, *, vertices, color='#00e5ff')[source]#

Bases: Widget

Draggable polygon overlay widget for 2-D plots.

Parameters:
  • push_fn (Callable) – Update callback.

  • vertices (list of (x, y) tuples) – Polygon vertices in pixel/data coordinates. Must have at least 3 vertices.

  • color (str, optional) – CSS colour for the polygon outline. Default "#00e5ff".

Raises:

ValueError – If fewer than 3 vertices provided.