From dd226cf06cf18433be723c5eae80d737b90478ec Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Sat, 7 Jun 2014 17:12:28 -0400 Subject: [PATCH] DOC : add documentation to Polygon methods closes #3035 --- lib/matplotlib/patches.py | 43 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/lib/matplotlib/patches.py b/lib/matplotlib/patches.py index 796280bbc480..a9fbf538374b 100644 --- a/lib/matplotlib/patches.py +++ b/lib/matplotlib/patches.py @@ -858,21 +858,64 @@ def __init__(self, xy, closed=True, **kwargs): self.set_xy(xy) def get_path(self): + """ + Get the path of the polygon + + Returns + ------- + path : Path + The :class:`~matplotlib.path.Path` object for + the polygon + """ return self._path def get_closed(self): + """ + Returns if the polygon is closed + + Returns + ------- + closed : bool + If the path is closed + """ return self._closed def set_closed(self, closed): + """ + Set if the polygon is closed + + Parameters + ---------- + closed : bool + True if the polygon is closed + """ if self._closed == bool(closed): return self._closed = bool(closed) self.set_xy(self.get_xy()) def get_xy(self): + """ + Get the vertices of the path + + Returns + ------- + vertices : numpy array + The coordinates of the vertices as a Nx2 + ndarray. + """ return self._path.vertices def set_xy(self, xy): + """ + Set the vertices of the polygon + + Parameters + ---------- + xy : numpy array or iterable of pairs + The coordinates of the vertices as a Nx2 + ndarray or iterable of pairs. + """ xy = np.asarray(xy) if self._closed: if len(xy) and (xy[0] != xy[-1]).any():