8000 Fix "UnboundLocalErrors" in mlab.py as reported by @huard https://git… · sherrylee/matplotlib@b765d87 · GitHub
[go: up one dir, main page]

Skip to content

Commit b765d87

Browse files
committed
Fix "UnboundLocalErrors" in mlab.py as reported by @huard mdboom@d6ec786#commitcomment-1061634
1 parent 80d1a7c commit b765d87

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

lib/matplotlib/mlab.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2999,15 +2999,17 @@ def poly_below(xmin, xs, ys):
29992999
ax.fill(xv, yv)
30003000
"""
30013001
if ma.isMaskedArray(xs) or ma.isMaskedArray(ys):
3002-
np = ma
3002+
numpy = ma
3003+
else:
3004+
numpy = np
30033005

3004-
xs = np.asarray(xs)
3005-
ys = np.asarray(ys)
3006+
xs = numpy.asarray(xs)
3007+
ys = numpy.asarray(ys)
30063008
Nx = len(xs)
30073009
Ny = len(ys)
30083010
assert(Nx==Ny)
3009-
x = xmin*np.ones(2*Nx)
3010-
y = np.ones(2*Nx)
3011+
x = xmin*numpy.ones(2*Nx)
3012+
y = numpy.ones(2*Nx)
30113013
x[:Nx] = xs
30123014
y[:Nx] = ys
30133015
y[Nx:] = ys[::-1]
@@ -3026,17 +3028,19 @@ def poly_between(x, ylower, yupper):
30263028
:meth:`matplotlib.axes.Axes.fill`.
30273029
"""
30283030
if ma.isMaskedArray(ylower) or ma.isMaskedArray(yupper) or ma.isMaskedArray(x):
3029-
np = ma
3031+
numpy = ma
3032+
else:
3033+
numpy = np
30303034

30313035
Nx = len(x)
30323036
if not cbook.iterable(ylower):
3033-
ylower = ylower*np.ones(Nx)
3037+
ylower = ylower*numpy.ones(Nx)
30343038

30353039
if not cbook.iterable(yupper):
3036-
yupper = yupper*np.ones(Nx)
3040+
yupper = yupper*numpy.ones(Nx)
30373041

3038-
x = np.concatenate( (x, x[::-1]) )
3039-
y = np.concatenate( (yupper, ylower[::-1]) )
3042+
x = numpy.concatenate( (x, x[::-1]) )
3043+
y = numpy.concatenate( (yupper, ylower[::-1]) )
30403044
return x,y
30413045

30423046

0 commit comments

Comments
 (0)
0