Skip to content

Commit a4fa82f

Browse files
committed
Scipy problem workarounds
svn path=/trunk/matplotlib/; revision=1906
1 parent 22a110e commit a4fa82f

2 files changed

Lines changed: 12 additions & 7 deletions

File tree

lib/matplotlib/contour.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,14 @@ def clabel(self, *args, **kwargs):
7575
levels = self.levels
7676
indices = range(len(self.levels))
7777
elif len(args) == 1:
78+
levlabs = list(args[0])
7879
indices, levels = [], []
7980
for i, lev in enumerate(self.levels):
80-
if lev in args[0]:
81+
if lev in levlabs:
8182
indices.append(i)
8283
levels.append(lev)
83-
if len(levels) < len(args[0]):
84-
msg = "Specified levels " + str(levels)
84+
if len(levels) < len(levlabs):
85+
msg = "Specified levels " + str(levlabs)
8586
msg += "\n don't match available levels "
8687
msg += str(self.levels)
8788
raise ValueError(msg)
@@ -426,7 +427,8 @@ def __init__(self, ax, *args, **kwargs):
426427
self.linewidths = 0.05 # Good default for Postscript.
427428
if iterable(self.linewidths):
428429
self.linewidths = self.linewidths[0]
429-
C = _contour.Cntr(x, y, z.filled(), z.mask())
430+
#C = _contour.Cntr(x, y, z.filled(), z.mask())
431+
C = _contour.Cntr(x, y, z.filled(), ma.getmask(z))
430432
lowers = self.levels[:-1]
431433
uppers = self.levels[1:]
432434
for level, level_upper, color in zip(lowers, uppers, self.tcolors):
@@ -441,7 +443,8 @@ def __init__(self, ax, *args, **kwargs):
441443

442444
else:
443445
tlinewidths = self._process_linewidths()
444-
C = _contour.Cntr(x, y, z.filled(), z.mask())
446+
#C = _contour.Cntr(x, y, z.filled(), z.mask())
447+
C = _contour.Cntr(x, y, z.filled(), ma.getmask(z))
445448
for level, color, width in zip(self.levels, self.tcolors, tlinewidths):
446449
nlist = C.trace(level, points = 1)
447450
col = LineCollection(nlist)

lib/matplotlib/lines.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,16 @@ def unmasked_index_ranges(mask, compressed = True):
5050
Example:
5151
5252
y = ma.array(arange(5), mask = [0,0,1,0,0])
53-
ii = unmasked_index_ranges(y.mask())
53+
#ii = unmasked_index_ranges(y.mask())
54+
ii = unmasked_index_ranges(ma.getmask(y))
5455
# returns [[0,2,] [2,4,]]
5556
5657
y.compressed().filled()[ii[1,0]:ii[1,1]]
5758
# returns array [3,4,]
5859
# (The 'filled()' method converts the masked array to a numerix array.)
5960
60-
i0, i1 = unmasked_index_ranges(y.mask(), compressed=False)
61+
#i0, i1 = unmasked_index_ranges(y.mask(), compressed=False)
62+
i0, i1 = unmasked_index_ranges(ma.getmask(y), compressed=False)
6163
# returns [[0,3,] [2,5,]]
6264
6365
y.filled()[ii[1,0]:ii[1,1]]

0 commit comments

Comments
 (0)