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

Skip to content

Commit 021aaa4

Browse files
committed
Fix finding norm for numpy 1.7
1 parent f635179 commit 021aaa4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/matplotlib/contour.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,9 @@ def calc_label_rot_and_inline(self, slc, ind, lw, lc=None, spacing=5):
402402

403403
def _path_length(X):
404404
dX = np.diff(X, axis=0)
405-
dX = np.linalg.norm(dX, axis=1)
405+
# Alternative to np.linalg.norm()
406+
# as numpy 1.7 doesn't have 'axis' kwarg
407+
dX = np.sum(dX**2, axis=1)**(1 / 2)
406408
return np.concatenate((np.zeros(1), np.cumsum(dX)))
407409
pl = _path_length(slc)
408410
pl = pl - pl[ind]

0 commit comments

Comments
 (0)