@@ -654,8 +654,15 @@ class LogitScale(ScaleBase):
654
654
"""
655
655
name = 'logit'
656
656
657
- def __init__ (self , axis , nonpos = 'mask' ):
658
- """
657
+ def __init__ (
658
+ self ,
659
+ axis ,
660
+ nonpos = 'mask' ,
661
+ * ,
662
+ one_half = r"\frac{1}{2}" ,
663
+ use_overline = False ,
664
+ ):
665
+ r"""
659
666
Parameters
660
667
----------
661
668
axis : `matplotlib.axis.Axis`
@@ -664,8 +671,15 @@ def __init__(self, axis, nonpos='mask'):
664
671
Determines the behavior for values beyond the open interval ]0, 1[.
665
672
They can either be masked as invalid, or clipped to a number very
666
673
close to 0 or 1.
674
+ use_overline: bool (default: False)
675
+ indicate the usage of survival notation (\overline{x}) in place of
676
+ standard notation (1-x) for probability close to one.
677
+ one_half : str (default: r"\frac{1}{2}")
678
+ the string used for ticks formatter to represent 1/2.
667
679
"""
668
680
self ._transform = LogitTransform (nonpos )
681
+ self ._use_overline = use_overline
682
+ self ._one_half = one_half
669
683
670
684
def get_transform (self ):
671
685
"""Return the `.LogitTransform` associated with this scale."""
@@ -675,9 +689,20 @@ def set_default_locators_and_formatters(self, axis):
675
689
# docstring inherited
676
690
# ..., 0.01, 0.1, 0.5, 0.9, 0.99, ...
677
691
axis .set_major_locator (LogitLocator ())
678
- axis .set_major_formatter (LogitFormatter ())
692
+ axis .set_major_formatter (
693
+ LogitFormatter (
694
+ one_half = self ._one_half ,
695
+ use_overline = self ._use_overline
696
+ )
697
+ )
679
698
axis .set_minor_locator (LogitLocator (minor = True ))
680
- axis .set_minor_formatter (LogitFormatter ())
699
+ axis .set_minor_formatter (
700
+ LogitFormatter (
701
+ minor = True ,
702
+ one_half = self ._one_half ,
703
+ use_overline = self ._use_overline
704
+ )
705
+ )
681
706
682
707
def limit_range_for_scale (self , vmin , vmax , minpos ):
683
708
"""
0 commit comments