Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ed4b877 commit 33cc440Copy full SHA for 33cc440
lib/matplotlib/patches.py
@@ -1066,10 +1066,18 @@ def set_xy(self, xy):
1066
----------
1067
xy : (N, 2) array-like
1068
The coordinates of the vertices.
1069
+
1070
+ Notes
1071
+ -----
1072
+ Unlike `~.path.Path`, we do not ignore the last input vertex. If the
1073
+ polygon is meant to be closed, and the last point of the polygon is not
1074
+ equal to the first, we assume that the user has not explicitly passed a
1075
+ ``CLOSEPOLY`` vertex, and add it ourselves.
1076
"""
1077
xy = np.asarray(xy)
1078
+ N, _ = xy.shape
1079
if self._closed:
- if len(xy) and (xy[0] != xy[-1]).any():
1080
+ if N == 1 or N > 1 and (xy[0] != xy[-1]).any():
1081
xy = np.concatenate([xy, [xy[0]]])
1082
else:
1083
if len(xy) > 2 and (xy[0] == xy[-1]).all():
0 commit comments