8000 Update comments re: colors._vector_magnitude. · matplotlib/matplotlib@3f6b2ed · GitHub
[go: up one dir, main page]

Skip to content

Commit 3f6b2ed

Browse files
committed
Update comments re: colors._vector_magnitude.
The helper is still needed, but the comments re: outdated numpys should be updated.
1 parent 163aac0 commit 3f6b2ed

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)
0