8000 BUG: check for closed path in Polygon.set_xy() by jakevdp · Pull Request #1018 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

BUG: check for closed path in Polygon.set_xy() #1018

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/matplotlib/patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -770,8 +770,6 @@ def __init__(self, xy, closed=True, **kwargs):
xy = np.asarray(xy, np.float_)
self._path = Path(xy)
self._closed = closed
if closed and len(xy):
xy = np.concatenate([xy, [xy[0]]])
self._set_xy(xy)

def get_path(self):
Expand All @@ -796,6 +794,8 @@ def set_closed(self, closed):
def get_xy(self):
return self._path.vertices
def set_xy(self, vertices):
if self._closed and len(vertices):
vertices = np.concatenate([vertices, [vertices[0]]])
self._path = Path(vertices, closed=self._closed)
_get_xy = get_xy
_set_xy = set_xy
Expand Down
0