Work around end-point duplication bug in Matplotlib

This commit is contained in:
Stefan van der Walt
2015-12-14 01:05:55 -08:00
parent bf7e885064
commit be667e0947
+3 -1
View File
@@ -35,9 +35,11 @@ def polygon_clip(rp, cp, r0, c0, r1, c1):
poly = path.Path(np.vstack((rp, cp)).T, closed=True)
clip_rect = transforms.Bbox([[r0, c0], [r1, c1]])
poly_clipped = clip_to_bbox(poly, clip_rect).to_polygons()[0]
if np.all(poly_clipped[-1] == poly_clipped[-2]):
poly_clipped = poly_clipped[:-1]
return poly_clipped[:, 0], poly_clipped[:, 1]