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

Skip to content

Commit b069a94

Browse files
committed
Return a scalar when passed in a scalar
Since possibly some earlier versions of numpy returned a scalar, wrap the value in atleast_1d before indexing.
1 parent 58c505c commit b069a94

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/matplotlib/colors.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,6 +1026,8 @@ def __call__(self, value, clip=None):
10261026
result = ma.masked_array(np.interp(result, x, y),
10271027
mask=ma.getmask(result))
10281028

1029+
if is_scalar:
1030+
result = np.atleast_1d(result)[0]
10291031
return result
10301032

10311033
def autoscale_None(self, A):

0 commit comments

Comments
 (0)