@@ -86,8 +86,8 @@ def get_transform(self):
8686
8787def  _mask_non_positives (a ):
8888    """ 
89-     Return a Numpy masked  array where all non-positive values are 
90-     replaced with NaNs.   If there are no non-positive values, the 
89+     Return a Numpy array where all non-positive values are 
90+     replaced with NaNs. If there are no non-positive values, the 
9191    original array is returned. 
9292    """ 
9393    mask  =  a  <=  0.0 
@@ -97,6 +97,7 @@ def _mask_non_positives(a):
9797
9898
9999def  _clip_non_positives (a ):
100+     a  =  np .array (a , float )
100101    a [a  <=  0.0 ] =  1e-300 
101102    return  a 
102103
@@ -120,8 +121,6 @@ class Log10Transform(LogTransformBase):
120121
121122    def  transform_non_affine (self , a ):
122123        a  =  self ._handle_nonpos (a  *  10.0 )
123-         if  isinstance (a , ma .MaskedArray ):
124-             return  ma .log10 (a )
125124        return  np .log10 (a )
126125
127126    def  inverted (self ):
@@ -147,8 +146,6 @@ class Log2Transform(LogTransformBase):
147146
148147    def  transform_non_affine (self , a ):
149148        a  =  self ._handle_nonpos (a  *  2.0 )
150-         if  isinstance (a , ma .MaskedArray ):
151-             return  ma .log (a ) /  np .log (2 )
152149        return  np .log2 (a )
153150
154151    def  inverted (self ):
@@ -174,8 +171,6 @@ class NaturalLogTransform(LogTransformBase):
174171
175172    def  transform_non_affine (self , a ):
176173        a  =  self ._handle_nonpos (a  *  np .e )
177-         if  isinstance (a , ma .MaskedArray ):
178-             return  ma .log (a )
179174        return  np .log (a )
180175
181176    def  inverted (self ):
@@ -212,8 +207,6 @@ def __init__(self, base, nonpos):
212207
213208    def  transform_non_affine (self , a ):
214209        a  =  self ._handle_nonpos (a  *  self .base )
215-         if  isinstance (a , ma .MaskedArray ):
216-             return  ma .log (a ) /  np .log (self .base )
217210        return  np .log (a ) /  np .log (self .base )
218211
219212    def  inverted (self ):
@@ -480,18 +473,18 @@ def get_transform(self):
480473
481474def  _mask_non_logit (a ):
482475    """ 
483-     Return a Numpy masked  array where all values outside ]0, 1[ are 
484-     masked . If all values are inside ]0, 1[, the original array is  
485-     returned. 
476+     Return a Numpy array where all values outside ]0, 1[ are 
477+     replaced with NaNs . If all values are inside ]0, 1[, the original 
478+     array is  returned. 
486479    """ 
487-     a  =  a .copy ()
488480    mask  =  (a  <=  0.0 ) |  (a  >=  1.0 )
489-     a [mask ] =  np .nan 
481+     if  mask .any ():
482+         return  np .where (mask , np .nan , a )
490483    return  a 
491484
492485
493486def  _clip_non_logit (a ):
494-     a  =  a . copy ( )
487+     a  =  np . array ( a ,  float )
495488    a [a  <=  0.0 ] =  1e-300 
496489    a [a  >=  1.0 ] =  1  -  1e-300 
497490    return  a 
@@ -514,8 +507,6 @@ def __init__(self, nonpos):
514507    def  transform_non_affine (self , a ):
515508        """logit transform (base 10), masked or clipped""" 
516509        a  =  self ._handle_nonpos (a )
517-         if  isinstance (a , ma .MaskedArray ):
518-             return  ma .log10 (1.0  *  a  /  (1.0  -  a ))
519510        return  np .log10 (1.0  *  a  /  (1.0  -  a ))
520511
521512    def  inverted (self ):
@@ -574,6 +565,9 @@ def set_default_locators_and_formatters(self, axis):
574565        axis .set_minor_formatter (LogitFormatter ())
575566
576567    def  limit_range_for_scale (self , vmin , vmax , minpos ):
568+         """ 
569+         Limit the domain to values between 0 and 1 (excluded). 
570+         """ 
577571        return  (vmin  <=  0  and  minpos  or  vmin ,
578572                vmax  >=  1  and  (1  -  minpos ) or  vmax )
579573
0 commit comments