Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit db2e090

Browse files
author
James R. Evans
committed
JRE: Modified as per efiring's suggestion
1 parent 40e3a90 commit db2e090

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

lib/matplotlib/mlab.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2982,19 +2982,10 @@ def inside_poly(points, verts):
29822982
that are inside the polygon.
29832983
"""
29842984
# Make a closed polygon path
2985-
codes = [ Path.LINETO ] * len(verts)
2986-
codes[ -1 ] = Path.CLOSEPOLY
2987-
p = Path( verts, codes )
2985+
poly = Path( verts )
29882986

29892987
# Check to see which points are contained withing the Path
2990-
res = []
2991-
idx = 0
2992-
while idx < len(points):
2993-
if p.contains_point( points[idx] ):
2994-
res.append( idx )
2995-
idx += 1
2996-
2997-
return res
2988+
return [ idx for idx, p in enumerate(points) if poly.contains_point(p) ]
29982989

29992990
def poly_below(xmin, xs, ys):
30002991
"""

0 commit comments

Comments
 (0)