@@ -458,7 +458,6 @@ def get_transform(self):
458458 return self ._transform
459459
460460
461-
462461class AsinhScale (ScaleBase ):
463462 """
464463 A quasi-logarithmic scale based on the inverse hyperbolic sine (asinh)
@@ -480,6 +479,8 @@ def __init__(self, axis, *, a0=1.0, **kwargs):
480479 The scale parameter defining the extent of the quasi-linear region.
481480 """
482481 super ().__init__ (axis )
482+ if a0 <= 0.0 :
483+ raise ValueError ("Scale parameter 'a0' must be strictly positive" )
483484 self .a0 = a0
484485
485486 def get_transform (self ):
@@ -490,7 +491,7 @@ def set_default_locators_and_formatters(self, axis):
490491 major_formatter = '{x:.3g}' )
491492
492493 class AsinhTransform (Transform ):
493- input_dims = output_dims = 1
494+ input_dims = output_dims = 1
494495
495496 def __init__ (self , a0 ):
496497 super ().__init__ ()
@@ -503,7 +504,7 @@ def inverted(self):
503504 return AsinhScale .InvertedAsinhTransform (self .a0 )
504505
505506 class InvertedAsinhTransform (Transform ):
506- input_dims = output_dims = 1
507+ input_dims = output_dims = 1
507508
508509 def __init__ (self , a0 ):
509510 super ().__init__ ()
@@ -526,9 +527,11 @@ def __init__(self, a0, apx_tick_count=12):
526527 Parameters
527528 ----------
528529 a0 : float
529- The scale parameter defining the extent of the quasi-linear region.
530+ The scale parameter defining the extent
531+ of the quasi-linear region.
530532 apx_tick_count : int, default: 12
531- The approximate number of major ticks that will fit along the entire axis
533+ The approximate number of major ticks that will fit
534+ along the entire axis
532535 """
533536 super ().__init__ ()
534537 self .a0 = a0
@@ -539,12 +542,14 @@ def __call__(self):
539542 return self .tick_values (dmin , dmax )
540543
541544 def tick_values (self , vmin , vmax ):
542- # Construct a set of "on-screen" locations that are uniformly spaced:
545+ # Construct a set of "on-screen" locations
546+ # that are uniformly spaced:
543547 ymin , ymax = self .a0 * np .arcsinh (np .array ([vmin , vmax ]) / self .a0 )
544548 ys = np .linspace (ymin , ymax , self .apx_tick_count )
545549 if (ymin * ymax ) < 0 :
546- # Ensure that zero tick-mark is included if the axis stradles zero
547- ys = np .hstack ([ ys , 0.0 ])
550+ # Ensure that the zero tick-mark is included,
551+ # if the axis stradles zero
552+ ys = np .hstack ([ys , 0.0 ])
548553
549554 # Transform the "on-screen" grid to the data space:
550555 xs = self .a0 * np .sinh (ys / self .a0 )
@@ -554,14 +559,14 @@ def tick_values(self, vmin, vmax):
554559 decades = (
555560 np .where (xs >= 0 , 1 , - 1 ) *
556561 np .power (10 , np .where (zero_xs , 1.0 ,
557- np .floor (np .log10 (np .abs (xs ) + zero_xs * 1e-6 ))))
562+ np .floor (np .log10 (np .abs (xs )
563+ + zero_xs * 1e-6 ))))
558564 )
559565 qs = decades * np .round (xs / decades )
560566
561567 return np .array (sorted (set (qs )))
562568
563569
564-
565570class LogitTransform (Transform ):
566571 input_dims = output_dims = 1
567572
0 commit comments