File tree 1 file changed +20
-0
lines changed
Filter options
1 file changed +20
-0
lines changed
Original file line number Diff line number Diff line change @@ -850,6 +850,8 @@ def __call__(self, value, clip=None):
850
850
vtype = 'scalar'
851
851
val = ma .array ([value ]).astype (np .float )
852
852
853
+ val = ma .masked_less_equal (val , 0 , copy = False )
854
+
853
855
self .autoscale_None (val )
854
856
vmin , vmax = self .vmin , self .vmax
855
857
if vmin > vmax :
@@ -879,6 +881,24 @@ def inverse(self, value):
879
881
else :
880
882
return vmin * pow ((vmax / vmin ), value )
881
883
884
+ def autoscale (self , A ):
885
+ '''
886
+ Set *vmin*, *vmax* to min, max of *A*.
887
+ '''
888
+ A = ma .masked_less_equal (A , 0 , copy = False )
889
+ self .vmin = ma .min (A )
890
+ self .vmax = ma .max (A )
891
+
892
+ def autoscale_None (self , A ):
893
+ ' autoscale only None-valued vmin or vmax'
894
+ if self .vmin is not None and self .vmax is not None :
895
+ return
896
+ A = ma .masked_less_equal (A , 0 , copy = False )
897
+ if self .vmin is None :
898
+ self .vmin = ma .min (A )
899
+ if self .vmax is None :
900
+ self .vmax = ma .max (A )
901
+
882
902
class BoundaryNorm (Normalize ):
883
903
'''
884
904
Generate a colormap index based on discrete intervals.
You can’t perform that action at this time.
0 commit comments