8000 Merge pull request #5722 from tacaswell/fix_norm_mutates_series · matplotlib/matplotlib@7a431e3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7a431e3

Browse files
committed
Merge pull request #5722 from tacaswell/fix_norm_mutates_series
FIX: do not mutate Series input to Normalize()
2 parents 82b29ae + b25c50b commit 7a431e3

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/matplotlib/colors.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -904,8 +904,11 @@ def process_value(value):
904904
is_scalar = False
905905
result = ma.asarray(value)
906906
if result.dtype.kind == 'f':
907-
if isinstance(value, np.ndarray):
908-
result = result.copy()
907+
# this is overkill for lists of floats, but required
908+
# to support pd.Series as input until we can reliable
909+
# determine if result and value share memory in all cases
910+
# (list, tuple, deque, ndarray, Series, ...)
911+
result = result.copy()
909912
elif result.dtype.itemsize > 2:
910913
result = result.astype(np.float)
911914
else:

0 commit comments

Comments
 (0)
0