matplotlib.patches.Polygon
-
class matplotlib.patches.Polygon(xy, closed=True, **kwargs)[source] -
Bases:
matplotlib.patches.PatchA general polygon patch.
xy is a numpy array with shape Nx2.
If closed is True, the polygon will be closed so the starting and ending points are the same.
Valid keyword arguments are:
Property Description agg_filtera filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array alphascalar or None animatedbool antialiasedor aaunknown capstyleCapStyleor {'butt', 'projecting', 'round'}clip_boxBboxclip_onbool clip_pathPatch or (Path, Transform) or None colorcolor containsunknown edgecoloror eccolor or None or 'auto' facecoloror fccolor or None figureFigurefillbool gidstr hatch{'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'} in_layoutbool joinstyleJoinStyleor {'miter', 'round', 'bevel'}labelobject linestyleor ls{'-', '--', '-.', ':', '', (offset, on-off-seq), ...} linewidthor lwfloat or None path_effectsAbstractPathEffectpickerNone or bool or float or callable rasterizedbool sketch_params(scale: float, length: float, randomness: float) snapbool or None transformTransformurlstr visiblebool zorderfloat -
__init__(self, xy, closed=True, **kwargs)[source] -
xy is a numpy array with shape Nx2.
If closed is True, the polygon will be closed so the starting and ending points are the same.
Valid keyword arguments are:
Property Description agg_filtera filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array alphascalar or None animatedbool antialiasedor aaunknown capstyleCapStyleor {'butt', 'projecting', 'round'}clip_boxBboxclip_onbool clip_pathPatch or (Path, Transform) or None colorcolor containsunknown edgecoloror eccolor or None or 'auto' facecoloror fccolor or None figureFigurefillbool gidstr hatch{'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'} in_layoutbool joinstyleJoinStyleor {'miter', 'round', 'bevel'}labelobject linestyleor ls{'-', '--', '-.', ':', '', (offset, on-off-seq), ...} linewidthor lwfloat or None path_effectsAbstractPathEffectpickerNone or bool or float or callable rasterizedbool sketch_params(scale: float, length: float, randomness: float) snapbool or None transformTransformurlstr visiblebool zorderfloat
-
__module__ = 'matplotlib.patches'
-
__str__(self)[source] -
Return str(self).
-
get_closed(self)[source] -
Return whether the polygon is closed.
-
get_xy(self)[source] -
Get the vertices of the path.
Returns: - (N, 2) numpy array
-
The coordinates of the vertices.
-
set_closed(self, closed)[source] -
Set whether the polygon is closed.
Parameters: -
closedbool -
True if the polygon is closed
-
-
set_xy(self, xy)[source] -
Set the vertices of the polygon.
Parameters: -
xy(N, 2) array-like -
The coordinates of the vertices.
Notes
Unlike
Path, we do not ignore the last input vertex. If the polygon is meant to be closed, and the last point of the polygon is not equal to the first, we assume that the user has not explicitly passed aCLOSEPOLYvertex, and add it ourselves. -
-
property xy -
The vertices of the path as (N, 2) numpy array.
-
Examples using matplotlib.patches.Polygon
© 2012–2021 Matplotlib Development Team. All rights reserved.
Licensed under the Matplotlib License Agreement.
https://matplotlib.org/3.4.1/api/_as_gen/matplotlib.patches.Polygon.html