Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 57f3fd9

Browse files
tacaswelltobias47n9e
authored andcommitted
DOC : add documentation to Polygon methods
closes #3035
1 parent 6a014d0 commit 57f3fd9

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

lib/matplotlib/patches.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -858,21 +858,64 @@ def __init__(self, xy, closed=True, **kwargs):
858858
self.set_xy(xy)
859859

860860
def get_path(self):
861+
"""
862+
Get the path of the polygon
863+
864+
Returns
865+
-------
866+
path : Path
867+
The :class:`~matplotlib.path.Path` object for
868+
the polygon
869+
"""
861870
return self._path
862871

863872
def get_closed(self):
873+
"""
874+
Returns if the polygon is closed
875+
876+
Returns
877+
-------
878+
closed : bool
879+
If the path is closed
880+
"""
864881
return self._closed
865882

866883
def set_closed(self, closed):
884+
"""
885+
Set if the polygon is closed
886+
887+
Parameters
888+
----------
889+
closed : bool
890+
True if the polygon is closed
891+
"""
867892
if self._closed == bool(closed):
868893
return
869894
self._closed = bool(closed)
870895
self.set_xy(self.get_xy())
871896

872897
def get_xy(self):
898+
"""
899+
Get the vertices of the path
900+
901+
Returns
902+
-------
903+
vertices : numpy array
904+
The coordinates of the vertices as a Nx2
905+
ndarray.
906+
"""
873907
return self._path.vertices
874908

875909
def set_xy(self, xy):
910+
"""
911+
Set the vertices of the polygon
912+
913+
Parameters
914+
----------
915+
xy : numpy array or iterable of pairs
916+
The coordinates of the vertices as a Nx2
917+
ndarray or iterable of pairs.
918+
"""
876919
xy = np.asarray(xy)
877920
if self._closed:
878921
if len(xy) and (xy[0] != xy[-1]).any():

0 commit comments

Comments
 (0)