vispy.visuals.polygon module#

Simple polygon visual based on MeshVisual and LineVisual

class vispy.visuals.polygon.PolygonVisual(pos=None, color='black', border_color=None, border_width=1, border_method='gl', triangulate=True, **kwargs)#

Bases: CompoundVisual

Displays a 2D polygon

Parameters:
posarray

Set of vertices defining the polygon.

colorstr | tuple | list of colors

Fill color of the polygon.

border_colorstr | tuple | list of colors

Border color of the polygon.

border_widthint

Border width in pixels. Line widths > 1px are only guaranteed to work when using border_method=’agg’ method.

border_methodstr

Mode to use for drawing the border line (see LineVisual).

  • “agg” uses anti-grain geometry to draw nicely antialiased lines with proper joins and endcaps.

  • “gl” uses OpenGL’s built-in line rendering. This is much faster, but produces much lower-quality results and is not guaranteed to obey the requested line width or join/endcap styles.

triangulateboolean

Triangulate the set of vertices

**kwargsdict

Keyword arguments to pass to CompoundVisual.

property border#

The vispy.visuals.LineVisual that is owned by the PolygonVisual. It is used to draw the border of the polygon

property border_color#

The border color of the polygon.

property color#

The color of the polygon.

property mesh#

The vispy.visuals.MeshVisual that is owned by the PolygonVisual. It is used to fill in the polygon

property pos#

The vertex position of the polygon.