@@ -1038,6 +1038,12 @@ def __call__(self, value, clip=None):
1038
1038
class LogNorm (Normalize ):
1039
1039
"""Normalize a given value to the 0-1 range on a log scale."""
1040
1040
1041
+ def _check_vmin_vmax (self ):
1042
+ if self .vmin > self .vmax :
1043
+ raise ValueError ("minvalue must be less than or equal to maxvalue" )
1044
+ elif self .vmin <= 0 :
1045
+ raise ValueError ("minvalue must be positive" )
1046
+
1041
1047
def __call__ (self , value , clip = None ):
1042
1048
if clip is None :
1043
1049
clip = self .clip
@@ -1047,12 +1053,9 @@ def __call__(self, value, clip=None):
1047
1053
result = np .ma .masked_less_equal (result , 0 , copy = False )
1048
1054
1049
1055
self .autoscale_None (result )
1056
+ self ._check_vmin_vmax ()
1050
1057
vmin , vmax = self .vmin , self .vmax
1051
- if vmin > vmax :
1052
- raise ValueError ("minvalue must be less than or equal to maxvalue" )
1053
- elif vmin <= 0 :
1054
- raise ValueError ("values must all be positive" )
1055
- elif vmin == vmax :
1058
+ if vmin == vmax :
1056
1059
result .fill (0 )
1057
1060
else :
1058
1061
if clip :
@@ -1078,6 +1081,7 @@ def __call__(self, value, clip=None):
1078
1081
def inverse (self , value ):
1079
1082
if not self .scaled ():
1080
1083
raise ValueError ("Not invertible until scaled" )
1084
+ self ._check_vmin_vmax ()
1081
1085
vmin , vmax = self .vmin , self .vmax
1082
1086
1083
1087
if np .iterable (value ):
0 commit comments