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

Skip to content

Commit 160f711

Browse files
authored
Merge pull request #16034 from anntzer/hillsh
Update comments re: colors._vector_magnitude.
2 parents 5829e30 + 3f6b2ed commit 160f711

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

lib/matplotlib/colors.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1570,15 +1570,11 @@ def hsv_to_rgb(hsv):
15701570

15711571
def _vector_magnitude(arr):
15721572
# things that don't work here:
1573-
# * np.linalg.norm
1574-
# - doesn't broadcast in numpy 1.7
1575-
# - drops the mask from ma.array
1576-
# * using keepdims - broken on ma.array until 1.11.2
1577-
# * using sum - discards mask on ma.array unless entire vector is masked
1578-
1573+
# * np.linalg.norm: drops mask from ma.array
1574+
# * np.sum: drops mask from ma.array unless entire vector is masked
15791575
sum_sq = 0
15801576
for i in range(arr.shape[-1]):
1581-
sum_sq += np.square(arr[..., i, np.newaxis])
1577+
sum_sq += arr[..., i, np.newaxis] ** 2
15821578
return np.sqrt(sum_sq)
15831579

15841580

0 commit comments

Comments
 (0)