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

Skip to content

Commit c22ad48

Browse files
committed
fixed poly between
svn path=/branches/v0_91_maint/; revision=6427
1 parent 2f6ee5e commit c22ad48

1 file changed

Lines changed: 4 additions & 14 deletions

File tree

lib/matplotlib/mlab.py

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1429,27 +1429,17 @@ def inside_poly(points, verts):
14291429
res, = np.nonzero(nxutils.points_inside_poly(points, verts))
14301430
return res
14311431

1432-
def poly_below(xmin, xs, ys):
1432+
def poly_below(ymin, xs, ys):
14331433
"""
14341434
given a sequence of xs and ys, return the vertices of a polygon
1435-
that has a horzontal base at xmin and an upper bound at the ys.
1436-
xmin is a scalar.
1435+
that has a horzintal base at ymin and an upper bound at the ys.
1436+
ymin is a scalar, and xs and ys are arrays
14371437
14381438
intended for use with Axes.fill, eg
14391439
xv, yv = poly_below(0, x, y)
14401440
ax.fill(xv, yv)
14411441
"""
1442-
xs = np.asarray(xs)
1443-
ys = np.asarray(ys)
1444-
Nx = len(xs)
1445-
Ny = len(ys)
1446-
assert(Nx==Ny)
1447-
x = xmin*np.ones(2*Nx)
1448-
y = np.ones(2*Nx)
1449-
x[:Nx] = xs
1450-
y[:Nx] = ys
1451-
y[Nx:] = ys[::-1]
1452-
return x, y
1442+
return poly_between(xs, ys, xmin)
14531443

14541444

14551445
def poly_between(x, ylower, yupper):

0 commit comments

Comments
 (0)