Skip to content

Commit c5e2ffd

Browse files
authored
Merge pull request #11883 from meeseeksmachine/auto-backport-of-pr-11862-on-v3.0.x
Backport PR #11862 on branch v3.0.x
2 parents a7d9384 + 42a6a04 commit c5e2ffd

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

lib/matplotlib/mlab.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -382,17 +382,7 @@ def detrend_mean(x, axis=None):
382382
if axis is not None and axis+1 > x.ndim:
383383
raise ValueError('axis(=%s) out of bounds' % axis)
384384

385-
# short-circuit 0-D array.
386-
if not x.ndim:
387-
return np.array(0., dtype=x.dtype)
388-
389-
# short-circuit simple operations
390-
if axis == 0 or axis is None or x.ndim <= 1:
391-
return x - x.mean(axis)
392-
393-
ind = [slice(None)] * x.ndim
394-
ind[axis] = np.newaxis
395-
return x - x.mean(axis)[ind]
385+
return x - x.mean(axis, keepdims=True)
396386

397387

398388
def detrend_none(x, axis=None):

0 commit comments

Comments
 (0)