@@ -880,22 +880,13 @@ def process_value(value):
880
880
Experimental; we may want to add an option to force the
881
881
use of float32.
882
882
"""
883
- if cbook .iterable (value ):
884
- is_scalar = False
885
- result = np .ma .asarray (value )
886
- if result .dtype .kind == 'f' :
887
- # this is overkill for lists of floats, but required
888
- # to support pd.Series as input until we can reliable
889
- # determine if result and value share memory in all cases
890
- # (list, tuple, deque, ndarray, Series, ...)
891
- result = result .copy ()
892
- elif result .dtype .itemsize > 2 :
893
- result = result .astype (float )
894
- else :
895
- result = result .astype (np .float32 )
896
- else :
897
- is_scalar = True
898
- result = np .ma .array ([value ]).astype (float )
883
+ is_scalar = not cbook .iterable (value )
884
+ if is_scalar :
885
+ value = [value ]
886
+ dtype = np .min_scalar_type (value )
887
+ dtype = (np .float32 if dtype .itemsize <= 2
888
+ else np .promote_types (dtype , float ))
889
+ result = np .ma .array (value , dtype = dtype , copy = True )
899
890
return result , is_scalar
900
891
901
892
def __call__ (self , value , clip = None ):
@@ -918,8 +909,6 @@ def __call__(self, value, clip=None):
918
909
elif vmin > vmax :
919
910
raise ValueError ("minvalue must be less than or equal to maxvalue" )
920
911
else :
921
- vmin = float (vmin )
922
- vmax = float (vmax )
923
912
if clip :
924
913
mask = np .ma .getmask (result )
925
914
result = np .ma .array (np .clip (result .filled (vmax ), vmin , vmax ),
@@ -938,8 +927,7 @@ def __call__(self, value, clip=None):
938
927
def inverse (self , value ):
939
928
if not self .scaled ():
940
929
raise ValueError ("Not invertible until scaled" )
941
- vmin = float (self .vmin )
942
- vmax = float (self .vmax )
930
+ vmin , vmax = self .vmin , self .vmax
943
931
944
932
if cbook .iterable (value ):
945
933
val = np .ma .asarray (value )
0 commit comments