Skip to content

Commit 9fc21ef

Browse files
committed
Fix: close polygon if requested, even if input array is already closed
1 parent 115275a commit 9fc21ef

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/matplotlib/patches.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,10 @@ def __init__(self, xy, closed=True, **kwargs):
768768
Patch.__init__(self, **kwargs)
769769
xy = np.asarray(xy, np.float_)
770770
self._path = Path(xy)
771-
self.set_closed(closed)
771+
self._closed = closed
772+
if closed and len(xy):
773+
xy = np.concatenate([xy, [xy[0]]])
774+
self._set_xy(xy)
772775

773776
def get_path(self):
774777
return self._path

0 commit comments

Comments
 (0)