
    
3j                        S r SSKrSSKrSSKJr  SSKrSSKrSSKJ	r	J
r
  SSKJrJrJrJrJrJrJrJrJrJrJr  SSKJrJr   " S S5      rS	 r " S
 S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r  " S S\5      r! " S S\!5      r" " S S\5      r# " S S\5      r$ " S S\5      r% " S S\5      r& " S  S!\5      r' " S" S#\5      r( " S$ S%\5      r) " S& S'\5      r* " S( S)\5      r+\\!\%\(\+\\"S*.r,S+S+S+S+S+S+S+S*.r-S, r.S- r/\/R                   (       a1  \/R                   S.S/Ra                  \1" \2\." 5       5      5      0-  \/l         S0 r3S1 r4\
Rj                  Rm                  S2S/Ra                  \." 5        V s/ s H  n \2" U 5      PM     sn 5      -  \4" 5       Ro                  5       S39  gs  sn f )4a  
Scales define the distribution of data values on an axis, e.g. a log scaling.

The mapping is implemented through `.Transform` subclasses.

The following scales are built-in:

.. _builtin_scales:

============= ===================== ================================ =================================
Name          Class                 Transform                        Inverted transform
============= ===================== ================================ =================================
"asinh"       `AsinhScale`          `AsinhTransform`                 `InvertedAsinhTransform`
"function"    `FuncScale`           `FuncTransform`                  `FuncTransform`
"functionlog" `FuncScaleLog`        `FuncTransform` + `LogTransform` `InvertedLogTransform` + `FuncTransform`
"linear"      `LinearScale`         `.IdentityTransform`             `.IdentityTransform`
"log"         `LogScale`            `LogTransform`                   `InvertedLogTransform`
"logit"       `LogitScale`          `LogitTransform`                 `LogisticTransform`
"symlog"      `SymmetricalLogScale` `SymmetricalLogTransform`        `InvertedSymmetricalLogTransform`
============= ===================== ================================ =================================

A user will often only use the scale name, e.g. when setting the scale through
`~.Axes.set_xscale`: ``ax.set_xscale("log")``.

See also the :ref:`scales examples <sphx_glr_gallery_scales>` in the documentation.

Custom scaling can be achieved through `FuncScale`, or by creating your own
`ScaleBase` subclass and corresponding transforms (see :doc:`/gallery/scales/custom_scale`).
Third parties can register their scales by name through `register_scale`.
    Nwraps)_api
_docstring)NullFormatterScalarFormatterLogFormatterSciNotationLogitFormatterNullLocator
LogLocatorAutoLocatorAutoMinorLocatorSymmetricalLogLocatorAsinhLocatorLogitLocator)	TransformIdentityTransformc                   6    \ rS rSrSrS rS rS rS rS r	Sr
g	)
	ScaleBase/   a  
The base class for all scales.

Scales are separable transformations, working on a single dimension.

Subclasses should override

:attr:`!name`
    The scale's name.
:meth:`get_transform`
    A method returning a `.Transform`, which converts data coordinates to
    scaled coordinates.  This transform should be invertible, so that e.g.
    mouse positions can be converted back to data coordinates.
:meth:`set_default_locators_and_formatters`
    A method that sets default locators and formatters for an `~.axis.Axis`
    that uses this scale.
:meth:`limit_range_for_scale`
    An optional method that "fixes" the axis range to acceptable values,
    e.g. restricting log-scaled axes to positive values.
c                     g)a  
Construct a new scale.

Notes
-----
The following note is for scale implementers.

For back-compatibility reasons, scales take an `~matplotlib.axis.Axis`
object as the first argument.

.. deprecated:: 3.11

   The *axis* parameter is now optional, i.e. matplotlib is compatible
   with `.ScaleBase` subclasses that do not take an *axis* parameter.

   The *axis* parameter is pending-deprecated. It will be deprecated
   in matplotlib 3.13, and removed in matplotlib 3.15.

   3rd-party scales are recommended to remove the *axis* parameter now
   if they can afford to restrict compatibility to matplotlib >= 3.11
   already. Otherwise, they may keep the *axis* parameter and remove it
   in time for matplotlib 3.13.
N selfaxiss     J/home/wildlama/miniconda3/lib/python3.13/site-packages/matplotlib/scale.py__init__ScaleBase.__init__E           c                     [        5       e)z<
Return the `.Transform` object associated with this scale.
NotImplementedErrorr   s    r   get_transformScaleBase.get_transform^   s     "##r    c                     [        5       e)zQ
Set the locators and formatters of *axis* to instances suitable for
this scale.
r"   r   s     r   #set_default_locators_and_formatters-ScaleBase.set_default_locators_and_formattersd   s    
 "##r    c                     X4$ )z
Return the range *vmin*, *vmax*, restricted to the
domain supported by this scale (if any).

*minpos* should be the minimum positive value in the data.
This is used by log scales to determine a minimum value.
r   r   vminvmaxminposs       r   limit_range_for_scaleScaleBase.limit_range_for_scalek   s     zr    c                    [         R                  " U5      n[         R                  " SS9    U R                  X"SS9u  p4[         R                  " U5      X2:H  -  XB:H  -  nSSS5        UR                  S:X  a  [        W5      $ W$ ! [
        [        4 a&    [         R                  " UR                  [        S9n NZf = f! , (       d  f       Nd= f)a<  
Return whether the value(s) are within the valid range for this scale.

Accepts a scalar or array-like ``val``. For a scalar, returns a
Python ``bool``. For an array, returns a bool ndarray of the same
shape. This is a generic implementation, and subclasses may implement
more efficient solutions for their domain.
ignoreinvalidYn)r.   )dtypeNr   )npasarrayerrstater/   isfinite	TypeError
ValueErrorzerosshapeboolndim)r   valarrr,   r-   results         r   val_in_rangeScaleBase.val_in_rangeu   s     jjo[[*J!777P
 S)T[9T[I +  #xx1}tF|8&8	 z* 9#))489 +*s-   B=B B=3B:7B=9B::B==
Cr   N)__name__
__module____qualname____firstlineno____doc__r   r%   r(   r/   rD   __static_attributes__r   r    r   r   r   /   s     *2$$9r    r   c                 0   ^  [        T 5      U 4S j5       nU$ )a  
Decorator to allow leaving out the *axis* parameter in scale constructors.

This decorator ensures backward compatibility for scale classes that
previously required an *axis* parameter. It allows constructors to be
called with or without the *axis* parameter.

For simplicity, this does not handle the case when *axis*
is passed as a keyword. However,
scanning GitHub, there's no evidence that that is used anywhere.

Parameters
----------
init_func : callable
    The original __init__ method of a scale class.

Returns
-------
callable
    A wrapped version of *init_func* that handles the optional *axis*.

Notes
-----
If the wrapped constructor defines *axis* as its first argument, the
parameter is preserved when present. Otherwise, the value `None` is injected
as the first argument.

Examples
--------
>>> from matplotlib.scale import ScaleBase
>>> class CustomScale(ScaleBase):
...     @_make_axis_parameter_optional
...     def __init__(self, axis, custom_param=1):
...         self.custom_param = custom_param
c                    > [         R                  " T5      n UR                  " U /UQ70 UD6  T" U /UQ70 UD6  g ! [         a    T" U S /UQ70 UD6   g f = fN)inspect	signaturebindr;   )r   argskwargssig	init_funcs       r   wrapper._make_axis_parameter_optional.<locals>.wrapper   sg    	*	-HHT+D+F+ d,T,V,  	3dD24262	3s   < AAr   )rU   rV   s   ` r   _make_axis_parameter_optionalrX      s$    H 9
- 
- Nr    c                   >    \ rS rSrSrSr\S 5       rS rS r	S r
Srg	)
LinearScale   z
The default linear scale.
linearc                     g)z	
        Nr   r   s     r   r   LinearScale.__init__   r   r    c                    UR                  [        5       5        UR                  [        5       5        UR	                  [        5       5        UR                  S:X  a  [        R                  S   (       d(  UR                  S:X  a2  [        R                  S   (       a  UR                  [        5       5        g UR                  [        5       5        g Nxzxtick.minor.visibleyzytick.minor.visibleset_major_locatorr   set_major_formatterr   set_minor_formatterr   	axis_namemplrcParamsset_minor_locatorr   r   r   s     r   r(   /LinearScale.set_default_locators_and_formatters       {}-  !23  1NNc!cll3H&I#%#,,7L*M""#3#56"";=1r    c                     [        5       $ )zh
Return the transform for linear scaling, which is just the
`~matplotlib.transforms.IdentityTransform`.
)r   r$   s    r   r%   LinearScale.get_transform   s    
 !""r    c                     [         R                  " U5      n[         R                  " U5      nUR                  S:X  a  [	        U5      $ U$ z|
Return whether the value(s) are within the valid range for this scale.

This is True for all values, except +-inf and NaN.
r   r7   r8   r:   r@   r?   r   rA   rB   rC   s       r   rD   LinearScale.val_in_range   8     jjoS!"xx1}tF|8&8r    r   N)rF   rG   rH   rI   rJ   namerX   r   r(   r%   rD   rK   r   r    r   rZ   rZ      s/     D" #
2#9r    rZ   c                   @   ^  \ rS rSrSrS=rrU 4S jrS rS r	Sr
U =r$ )FuncTransform   z]
A simple transform that takes and arbitrary function for the
forward and inverse transform.
   c                    > [         TU ]  5         [        U5      (       a  [        U5      (       a  Xl        X l        g[        S5      e)aS  
Parameters
----------
forward : callable
    The forward function for the transform.  This function must have
    an inverse and, for best behavior, be monotonic.
    It must have the signature::

       def forward(values: array-like) -> array-like

inverse : callable
    The inverse of the forward function.  Signature as ``forward``.
z,arguments to FuncTransform must be functionsN)superr   callable_forward_inverser<   )r   forwardinverse	__class__s      r   r   FuncTransform.__init__   s;     	G'!2!2#M#MKLLr    c                 $    U R                  U5      $ rN   )r}   r   valuess     r   transform_non_affine"FuncTransform.transform_non_affine  s    }}V$$r    c                 B    [        U R                  U R                  5      $ rN   )rw   r~   r}   r$   s    r   invertedFuncTransform.inverted	  s    T]]DMM::r    )r}   r~   rF   rG   rH   rI   rJ   
input_dimsoutput_dimsr   r   r   rK   __classcell__r   s   @r   rw   rw      s)    
  ! JM*%; ;r    rw   c                   8    \ rS rSrSrSr\S 5       rS rS r	Sr
g)		FuncScalei  zF
Provide an arbitrary scale with user-supplied function for the axis.
functionc                 .    Uu  p4[        X45      nXPl        g)a  
Parameters
----------
axis : `~matplotlib.axis.Axis`
    The axis for the scale.

    .. note::
        This parameter is unused and will be removed in an imminent release.
        It can already be left out because of special preprocessing,
        so that ``FuncScale(functions)`` is valid.

functions : (callable, callable)
    two-tuple of the forward and inverse functions for the scale.
    The forward function must be monotonic.

    Both functions must have the signature::

       def forward(values: array-like) -> array-like
N)rw   
_transform)r   r   	functionsr   r   	transforms         r   r   FuncScale.__init__  s    * %!'3	#r    c                     U R                   $ )z7Return the `.FuncTransform` associated with this scale.r   r$   s    r   r%   FuncScale.get_transform-      r    c                    UR                  [        5       5        UR                  [        5       5        UR	                  [        5       5        UR                  S:X  a  [        R                  S   (       d(  UR                  S:X  a2  [        R                  S   (       a  UR                  [        5       5        g UR                  [        5       5        g r`   rc   r   s     r   r(   -FuncScale.set_default_locators_and_formatters1  rl   r    r   N)rF   rG   rH   rI   rJ   ru   rX   r   r%   r(   rK   r   r    r   r   r     s*     D"$ #$0
2r    r   c                   F   ^  \ rS rSrS=rrSU 4S jjrS rS rS r	Sr
U =r$ )	LogTransformi>  ry   c                    > [         TU ]  5         US::  d  US:X  a  [        S5      eXl        [        R
                  " SSS.US9U l        [        R                  [        R                  S[        R                  S	[        R                  0U l        g )
Nr   ry   z#The log base cannot be <= 0 or == 1TFclipmasknonpositive   
   )r{   r   r<   baser   getitem_checked_clipr7   eloglog2log10
_log_funcs)r   r   r   r   s      r   r   LogTransform.__init__A  sm    19	BCC	))5){D
44BGGRBr    c                     SR                  [        U 5      R                  U R                  U R                  (       a  S5      $ S5      $ )Nz{}(base={}, nonpositive={!r})r   r   )formattyperF   r   r   r$   s    r   __str__LogTransform.__str__J  sA    .55JdjjFN 	NFLN 	Nr    c                 n   [         R                  " SSS9   U R                  R                  U R                  5      nU(       a	  U" U5      nO7[         R
                  " U5      [         R
                  " U R                  5      -  nU R                  (       a  SX1S:*  '   S S S 5        U$ ! , (       d  f       W$ = f)Nr2   divider4   r   )r7   r9   r   getr   r   r   )r   r   log_funcouts       r   r   !LogTransform.transform_non_affineN  s    [[(;**4995Hv&ffVnrvvdii'88zz $)aK ! <" 
# <;" 
s   BB%%
B4c                 ,    [        U R                  5      $ rN   )InvertedLogTransformr   r$   s    r   r   LogTransform.invertedc  s    #DII..r    )r   r   r   )r   rF   rG   rH   rI   r   r   r   r   r   r   rK   r   r   s   @r   r   r   >  s(      JCN*/ /r    r   c                   B   ^  \ rS rSrS=rrU 4S jrS rS rS r	Sr
U =r$ )r   ig  ry   c                    > [         TU ]  5         Xl        [        R                  [        R
                  S[        R                  0U l        g )Nr   )r{   r   r   r7   r   expexp2
_exp_funcs)r   r   r   s     r   r   InvertedLogTransform.__init__j  s/    	44BGG4r    c                 L    [        U 5      R                   SU R                   S3$ )Nz(base=))r   rF   r   r$   s    r   r   InvertedLogTransform.__str__o  s$    t*%%&fTYYKq99r    c                     U R                   R                  U R                  5      nU(       a  U" U5      $ [        R                  " U[        R
                  " U R                  5      -  5      $ rN   )r   r   r   r7   r   r   )r   r   exp_funcs      r   r   )InvertedLogTransform.transform_non_affiner  sI    ??&&tyy1F##66&266$))#4455r    c                 ,    [        U R                  5      $ rN   )r   r   r$   s    r   r   InvertedLogTransform.invertedy  s    DII&&r    )r   r   r   r   s   @r   r   r   g  s&      J5
:6' 'r    r   c                   f    \ rS rSrSrSr\SSSSS.S jj5       r\" S	 5      r	S
 r
S rS rS rSrg)LogScalei}  zL
A standard logarithmic scale.  Care is taken to only plot positive values.
r   Nr   r   )r   subsr   c                0    [        X$5      U l        X0l        g)a  
Parameters
----------
axis : `~matplotlib.axis.Axis`
    The axis for the scale.

    .. note::
        This parameter is unused and about to be removed in the future.
        It can already now be left out because of special preprocessing,
        so that ``LogScale(base=2)`` is valid.

base : float, default: 10
    The base of the logarithm.
nonpositive : {'clip', 'mask'}, default: 'clip'
    Determines the behavior for non-positive values. They can either
    be masked as invalid, or clipped to a very small positive number.
subs : sequence of int, default: None
    Where to place the subticks between each major tick.  For example,
    in a log10 scale, ``[2, 3, 4, 5, 6, 7, 8, 9]`` will place 8
    logarithmically spaced minor ticks between each major tick.
N)r   r   r   )r   r   r   r   r   s        r   r   LogScale.__init__  s    . 't9	r    c                 .    U R                   R                  $ rN   r   r   r$   s    r   <lambda>LogScale.<lambda>      !5!5r    c                 P   UR                  [        U R                  5      5        UR                  [	        U R                  5      5        UR                  [        U R                  U R                  5      5        UR                  [	        U R                  U R                  S LS95        g )N)labelOnlyBase)rd   r   r   re   r	   rj   r   rf   r   s     r   r(   ,LogScale.set_default_locators_and_formatters  sx    z$))45  !8!CDz$))TYY?@  #DII3799D3HK	Lr    c                     U R                   $ )z6Return the `.LogTransform` associated with this scale.r   r$   s    r   r%   LogScale.get_transform  r   r    c                 f    [         R                  " U5      (       d  SnUS::  a  UOUUS::  a  U4$ U4$ )z$Limit the domain to positive values.r5   r   r7   r:   r+   s       r   r/   LogScale.limit_range_for_scale  sA    {{6""F!)!)/ 	/)-/ 	/r    c                     [         R                  " U5      n[         R                  " SS9   [         R                  " U5      US:  -  nSSS5        UR                  S:X  a  [        W5      $ W$ ! , (       d  f       N+= f)z|
Return whether the value(s) are within the valid range for this scale.

This is True for value(s) > 0 except +inf and NaN.
r2   r3   r   N)r7   r8   r9   r:   r@   r?   rr   s       r   rD   LogScale.val_in_range  s[     jjo[[*[[%q1F +"xx1}tF|8&8 +*s   A--
A;r   r   rN   )rF   rG   rH   rI   rJ   ru   rX   r   propertyr   r(   r%   r/   rD   rK   r   r    r   r   r   }  sM     D""4V  #2 56DL/	9r    r   c                   F    \ rS rSrSrSr\S	S j5       r\S 5       r	S r
Srg)
FuncScaleLogi  zi
Provide an arbitrary scale with user-supplied function for the axis and
then put on a logarithmic axes.
functionlogc                 R    Uu  pESU l         [        XE5      [        U5      -   U l        g)am  
Parameters
----------
axis : `~matplotlib.axis.Axis`
    The axis for the scale.

    .. note::
        This parameter is unused and about to be removed in the future.
        It can already now be left out because of special preprocessing,
        so that ``FuncScaleLog(functions=(forward, inverse))`` is valid.
functions : (callable, callable)
    two-tuple of the forward and inverse functions for the scale.
    The forward function must be monotonic.

    Both functions must have the signature::

        def forward(values: array-like) -> array-like

base : float, default: 10
    Logarithmic base of the scale.
N)r   rw   r   r   )r   r   r   r   r   r   s         r   r   FuncScaleLog.__init__  s)    . %	'9L<NNr    c                 B    U R                   R                  R                  $ rN   )r   _br   r$   s    r   r   FuncScaleLog.base  s    !!&&&r    c                     U R                   $ )z3Return the `.Transform` associated with this scale.r   r$   s    r   r%   FuncScaleLog.get_transform  r   r    r   N)r   )rF   rG   rH   rI   rJ   ru   rX   r   r   r   r%   rK   r   r    r   r   r     s;    
 D"O #O4 ' 'r    r   c                   <   ^  \ rS rSrS=rrU 4S jrS rS rSr	U =r
$ )SymmetricalLogTransformi  ry   c                    > [         TU ]  5         US::  a  [        S5      eUS::  a  [        S5      eUS::  a  [        S5      eXl        X l        X0l        g N      ?z'base' must be larger than 1        z'linthresh' must be positivez'linscale' must be positiver{   r   r<   r   	linthreshlinscaler   r   r   r   r   s       r   r    SymmetricalLogTransform.__init__  W    3;;<<;<<s?:;;	" r    c                 D   U R                   SSU R                  -  -
  -  n[        R                  " U R                  5      n[        R                  " U5      nX@R
                  :*  n[        R                  " U5      (       a  X-  $ [        R                  " SSS9   [        R                  " U5      U R
                  -  U[        R                  " U R
                  5      U-  -
  [        R                  " U5      U-  -   -  nS S S 5        X   U-  WU'   U$ ! , (       d  f       N= fNr   r2   r   )	r   r   r7   r   absr   allr9   sign)r   r   linscale_adjlog_baseabs_ainsider   s          r   r   ,SymmetricalLogTransform.transform_non_affine  s    }}cDIIo(=>66$))$v..(66&>>(([[(;''&/DNN2rvvdnn5@@u()*C < n|3F
 <;s   A%D
Dc                 X    [        U R                  U R                  U R                  5      $ rN   )InvertedSymmetricalLogTransformr   r   r   r$   s    r   r    SymmetricalLogTransform.inverted
  s"    .tyy$../3}}> 	>r    r   r   r   )rF   rG   rH   rI   r   r   r   r   r   rK   r   r   s   @r   r   r     s!      J
!> >r    r   c                   x   ^  \ rS rSrS=rrU 4S jr\R                  " SSSSS9\	S	 5       5       r
S
 rS rSrU =r$ )r  i  ry   c                    > [         TU ]  5         US::  a  [        S5      eUS::  a  [        S5      eUS::  a  [        S5      eXl        X l        X0l        g r   r   r   s       r   r   (InvertedSymmetricalLogTransform.__init__  r   r    3.11invlinthresh	attributez .inverted().transform(linthresh))ru   obj_typealternativec                 X    U R                  5       R                  U R                  5      nU$ rN   )r   r   r   )r   r  s     r   r  ,InvertedSymmetricalLogTransform.invlinthresh  s$     }}00@r    c                 N   U R                   SSU R                  -  -
  -  nU R                  5       R                  U R                  5      n[
        R                  " U5      nXC:*  n[
        R                  " U5      (       a  X-  $ [
        R                  " SSS9   [
        R                  " U5      U R                  -  [
        R                  " X@R                  -  U-
  [
        R                  " U R                  5      -  5      -  nS S S 5        X   U-  WU'   U$ ! , (       d  f       N= fr   )r   r   r   r   r   r7   r   r   r9   r   r   r   )r   r   r  r  r  r  r   s          r   r   4InvertedSymmetricalLogTransform.transform_non_affine%  s    }}cDIIo(=>}}00@v&66&>>(([[(;''&/DNN2RVV',6"&&:KK6M MC < n|3F
	 <;s   A+D
D$c                 X    [        U R                  U R                  U R                  5      $ rN   )r   r   r   r   r$   s    r   r   (InvertedSymmetricalLogTransform.inverted3  s$    &tyy'+~~t}}F 	Fr    r	  )rF   rG   rH   rI   r   r   r   r   
deprecatedr   r  r   r   rK   r   r   s   @r   r  r    sS      J
! 
__V.;!CE EF Fr    r  c                       \ rS rSrSrSr\SSSSSS.S	 jj5       r\" S
 5      r	\" S 5      r
\" S 5      rS rS rS rSrg)SymmetricalLogScalei8  a  
The symmetrical logarithmic scale is logarithmic in both the
positive and negative directions from the origin.

Since the values close to zero tend toward infinity, there is a
need to have a range around zero that is linear.  The parameter
*linthresh* allows the user to specify the size of this range
(-*linthresh*, *linthresh*).

See :doc:`/gallery/scales/symlog_demo` for a detailed description.

Parameters
----------
axis : `~matplotlib.axis.Axis`
    The axis for the scale.

    .. note::
        This parameter is unused and about to be removed in the future.
        It can already now be left out because of special preprocessing,
        so that ``SymmetricalLocSacle(base=2)`` is valid.

base : float, default: 10
    The base of the logarithm.

linthresh : float, default: 2
    Defines the range ``(-x, x)``, within which the plot is linear.
    This avoids having the plot go to infinity around zero.

subs : sequence of int
    Where to place the subticks between each major tick.
    For example, in a log10 scale: ``[2, 3, 4, 5, 6, 7, 8, 9]`` will place
    8 logarithmically spaced minor ticks between each major tick.

linscale : float, optional
    This allows the linear range ``(-linthresh, linthresh)`` to be
    stretched relative to the logarithmic range. Its value is the number of
    decades to use for each half of the linear range. For example, when
    *linscale* == 1.0 (the default), the space used for the positive and
    negative halves of the linear range will be equal to one decade in
    the logarithmic range.
symlogNr   r   ry   )r   r   r   r   c                2    [        X#U5      U l        X@l        g rN   )r   r   r   )r   r   r   r   r   r   s         r   r   SymmetricalLogScale.__init__d  s    1$8L	r    c                 .    U R                   R                  $ rN   r   r$   s    r   r   SymmetricalLogScale.<lambda>i  r   r    c                 .    U R                   R                  $ rN   )r   r   r$   s    r   r   r  j  s    doo&?&?r    c                 .    U R                   R                  $ rN   )r   r   r$   s    r   r   r  k  s    T__%=%=r    c                 4   UR                  [        U R                  5       5      5        UR                  [	        U R
                  5      5        UR                  [        U R                  5       U R                  5      5        UR                  [        5       5        g rN   )
rd   r   r%   re   r	   r   rj   r   rf   r   r   s     r   r(   7SymmetricalLogScale.set_default_locators_and_formattersm  sq    4T5G5G5IJK  !8!CD4T5G5G5I59YY @ 	A  1r    c                     U R                   $ )zAReturn the `.SymmetricalLogTransform` associated with this scale.r   r$   s    r   r%   !SymmetricalLogScale.get_transformu  r   r    c                     [         R                  " U5      n[         R                  " U5      nUR                  S:X  a  [	        U5      $ U$ rp   rq   rr   s       r   rD    SymmetricalLogScale.val_in_rangey  rt   r    r   rN   )rF   rG   rH   rI   rJ   ru   rX   r   r   r   r   r   r(   r%   rD   rK   r   r    r   r  r  8  s`    (R D""q  # 56D?@I=>H29r    r  c                   @   ^  \ rS rSrSrS=rrU 4S jrS rS r	Sr
U =r$ )AsinhTransformi  z<Inverse hyperbolic-sine transformation used by `.AsinhScale`ry   c                 P   > [         TU ]  5         US::  a  [        S5      eXl        g )Nr   z8Scale parameter 'linear_width' must be strictly positive)r{   r   r<   linear_widthr   r+  r   s     r   r   AsinhTransform.__init__  s.    3 9 : :(r    c                 `    U R                   [        R                  " XR                   -  5      -  $ rN   )r+  r7   arcsinhr   s     r   r   #AsinhTransform.transform_non_affine  s%      2::f7H7H.H#IIIr    c                 ,    [        U R                  5      $ rN   )InvertedAsinhTransformr+  r$   s    r   r   AsinhTransform.inverted  s    %d&7&788r    r+  r   r   s   @r   r)  r)    s%    F  J)J9 9r    r)  c                   @   ^  \ rS rSrSrS=rrU 4S jrS rS r	Sr
U =r$ )r2  i  z4Hyperbolic sine transformation used by `.AsinhScale`ry   c                 .   > [         TU ]  5         Xl        g rN   )r{   r   r+  r,  s     r   r   InvertedAsinhTransform.__init__  s    (r    c                 `    U R                   [        R                  " XR                   -  5      -  $ rN   )r+  r7   sinhr   s     r   r   +InvertedAsinhTransform.transform_non_affine  s%      27764E4E+E#FFFr    c                 ,    [        U R                  5      $ rN   )r)  r+  r$   s    r   r   InvertedAsinhTransform.inverted      d//00r    r4  r   r   s   @r   r2  r2    s%    >  J)G1 1r    r2  c            	          ^  \ rS rSrSrSrSSSSSSSS	S
.r\SSSSS.U 4S jjj5       r\	" S 5      r
S rS rS rSrU =r$ )
AsinhScalei  a  
A quasi-logarithmic scale based on the inverse hyperbolic sine (asinh)

For values close to zero, this is essentially a linear scale,
but for large magnitude values (either positive or negative)
it is asymptotically logarithmic. The transition between these
linear and logarithmic regimes is smooth, and has no discontinuities
in the function gradient in contrast to
the `.SymmetricalLogScale` ("symlog") scale.

Specifically, the transformation of an axis coordinate :math:`a` is
:math:`a \rightarrow a_0 \sinh^{-1} (a / a_0)` where :math:`a_0`
is the effective width of the linear region of the transformation.
In that region, the transformation is
:math:`a \rightarrow a + \mathcal{O}(a^3)`.
For large values of :math:`a` the transformation behaves as
:math:`a \rightarrow a_0 \, \mathrm{sgn}(a) \ln |a| + \mathcal{O}(1)`.

.. note::

   This API is provisional and may be revised in the future
   based on early user feedback.
asinh)r   )r      )r      )r   rA     )rA     )   i   )   rA  rB  rC  r   rD  @   i   r   r   auto)r+  r   r   c                   > [         TU ]  U5        [        U5      U l        [	        U5      U l        US:X  a+  U R                  R                  U R
                  5      U l        gX@l        g)a  
Parameters
----------
axis : `~matplotlib.axis.Axis`
    The axis for the scale.

    .. note::
        This parameter is unused and about to be removed in the future.
        It can already now be left out because of special preprocessing,
        so that ``AsinhScale()`` is valid.

linear_width : float, default: 1
    The scale parameter (elsewhere referred to as :math:`a_0`)
    defining the extent of the quasi-linear region,
    and the coordinate values beyond which the transformation
    becomes asymptotically logarithmic.
base : int, default: 10
    The number base used for rounding tick locations
    on a logarithmic scale. If this is less than one,
    then rounding is to the nearest integer multiple
    of powers of ten.
subs : sequence of int
    Multiples of the number base used for minor ticks.
    If set to 'auto', this will use built-in defaults,
    e.g. (2, 5) for base=10.
rH  N)	r{   r   r)  r   int_baseauto_tick_multipliersr   _subs)r   r   r+  r   r   rS   r   s         r   r   AsinhScale.__init__  sQ    : 	(6Y
6>3377

CDJJr    c                 .    U R                   R                  $ rN   )r   r+  r$   s    r   r   AsinhScale.<lambda>  s    )E)Er    c                     U R                   $ rN   r   r$   s    r   r%   AsinhScale.get_transform  s    r    c           	      H   UR                  [        U R                  U R                  S9[        U R                  U R                  U R                  S9[        5       S9  U R                  S:  a%  UR                  [        U R                  5      5        g UR                  S5        g )N)r   )r   r   )major_locatorminor_locatorminor_formatterry   z{x:.3g})setr   r+  rK  rM  r   re   r	   r   s     r   r(   .AsinhScale.set_default_locators_and_formatters  s    |D,=,=15 =+D,=,=1515 = "/ 	 	2 ::>$$%<TZZ%HI$$Y/r    c                     [         R                  " U5      n[         R                  " U5      nUR                  S:X  a  [	        U5      $ U$ rp   rq   rr   s       r   rD   AsinhScale.val_in_range  rt   r    )rK  rM  r   rN   )rF   rG   rH   rI   rJ   ru   rL  rX   r   r   r+  r%   r(   rD   rK   r   r   s   @r   r?  r?    sx    0 D 	 #"#v" " #"H EFL
09 9r    r?  c                   F   ^  \ rS rSrS=rrSU 4S jjrS rS rS r	Sr
U =r$ )	LogitTransformi  ry   c                 v   > [         TU ]  5         [        R                  " SS/US9  Xl        SSS.U   U l        g )Nr   r   r   TFr   )r{   r   r   check_in_list_nonpositiver   r   r   r   s     r   r   LogitTransform.__init__  s:    FF+E'"E2;?
r    c                     [         R                  " SSS9   [         R                  " USU-
  -  5      nSSS5        U R                  (       a  SWUS:*  '   SUSU:*  '   W$ ! , (       d  f       N1= f)z,logit transform (base 10), masked or clippedr2   r   ry   Nr   r   i  )r7   r9   r   r   )r   r   r   s      r   r   #LogitTransform.transform_non_affine  s]    [[(;((6QZ01C <::$C!#CV
 <;s   A
A,c                 ,    [        U R                  5      $ rN   )LogisticTransformr_  r$   s    r   r   LogitTransform.inverted  s     !2!233r    c                 N    [        U 5      R                   SU R                  < S3$ N(r   r   rF   r_  r$   s    r   r   LogitTransform.__str__!  '    t*%%&a(9(9'<A>>r    )r   r_  r   rF   rG   rH   rI   r   r   r   r   r   r   rK   r   r   s   @r   r\  r\    s'      J@4? ?r    r\  c                   F   ^  \ rS rSrS=rrSU 4S jjrS rS rS r	Sr
U =r$ )	re  i%  ry   c                 .   > [         TU ]  5         Xl        g rN   )r{   r   r_  r`  s     r   r   LogisticTransform.__init__(  s    'r    c                     SSSU* -  -   -  $ )zlogistic transform (base 10)r   ry   r   r   r   s     r   r   &LogisticTransform.transform_non_affine,  s    a"w-'((r    c                 ,    [        U R                  5      $ rN   )r\  r_  r$   s    r   r   LogisticTransform.inverted0  r=  r    c                 N    [        U 5      R                   SU R                  < S3$ rh  rj  r$   s    r   r   LogisticTransform.__str__3  rl  r    )r_  rm  rn  r   s   @r   re  re  %  s&      J()1? ?r    re  c                   R    \ rS rSrSrSr\SSSS.S jj5       rS	 rS
 r	S r
S rSrg)
LogitScalei7  z
Logit scale for data between zero and one, both excluded.

This scale is similar to a log scale close to zero and to one, and almost
linear around 0.5. It maps the interval ]0, 1[ onto ]-infty, +infty[.
logitNz\frac{1}{2}Fone_halfuse_overlinec                <    [        U5      U l        X@l        X0l        g)a  
Parameters
----------
axis : `~matplotlib.axis.Axis`
    The axis for the scale.

    .. note::
        This parameter is unused and about to be removed in the future.
        It can already now be left out because of special preprocessing,
        so that ``LogitScale()`` is valid.

nonpositive : {'mask', 'clip'}
    Determines the behavior for values beyond the open interval ]0, 1[.
    They can either be masked as invalid, or clipped to a number very
    close to 0 or 1.
use_overline : bool, default: False
    Indicate the usage of survival notation (\overline{x}) in place of
    standard notation (1-x) for probability close to one.
one_half : str, default: r"\frac{1}{2}"
    The string used for ticks formatter to represent 1/2.
N)r\  r   _use_overline	_one_half)r   r   r   r|  r}  s        r   r   LogitScale.__init__@  s    0 )5)!r    c                     U R                   $ )z8Return the `.LogitTransform` associated with this scale.r   r$   s    r   r%   LogitScale.get_transform\  r   r    c                    UR                  [        5       5        UR                  [        U R                  U R
                  S95        UR                  [        SS95        UR                  [        SU R                  U R
                  S95        g )Nr{  T)minor)r  r|  r}  )rd   r   re   r
   r  r  rj   rf   r   s     r   r(   .LogitScale.set_default_locators_and_formatters`  sx     	|~.  !//	
 	|$78  !//	
r    c                 l    [         R                  " U5      (       d  SnUS::  a  UOUUS:  a  SU-
  4$ U4$ )z8
Limit the domain to values between 0 and 1 (excluded).
gHz>r   ry   r   r+   s       r   r/    LogitScale.limit_range_for_scales  sG     {{6""F!)"aiF
3 	3-13 	3r    c                     [         R                  " U5      n[         R                  " SS9   SU:  US:  -  nSSS5        UR                  S:X  a  [	        W5      $ W$ ! , (       d  f       N+= f)z
Return whether the value(s) are within the valid range for this scale.

This is True for value(s) which are between 0 and 1 (excluded).
r2   r3   r   ry   N)r7   r8   r9   r@   r?   rr   s       r   rD   LogitScale.val_in_range|  sV     jjo[[*#g#'*F +"xx1}tF|8&8 +*s   A
A*)r  r   r  )Nr   )rF   rG   rH   rI   rJ   ru   rX   r   r%   r(   r/   rD   rK   r   r    r   ry  ry  7  s>     D""(u" #"6
&3	9r    ry  )r\   r   r  r@  rz  r   r   Tc                       [        [        5      $ )z)Return the names of the available scales.)sorted_scale_mappingr   r    r   get_scale_namesr    s    .!!r    c                 r    [         R                  " [        U S9n[        U    (       a	  U" U40 UD6$ U" S0 UD6$ )zi
Return a scale class by name.

Parameters
----------
scale : {%(names)s}
axis : `~matplotlib.axis.Axis`
)scaler   )r   r   r  _scale_has_axis_parameter)r  r   rS   	scale_clss       r   scale_factoryr    s<     $$^5AI '((("6""r    namesz, c                     U [         U R                  '   S[        R                  " U 5      R                  ;   nU[
        U R                  '   U(       a&  [        R                  " SSU R                  < S3SS9  gg)zw
Register a new kind of scale.

Parameters
----------
scale_class : subclass of `ScaleBase`
    The scale to register.
r   r  z
The scale z uses an 'axis' parameter in the constructors. This parameter is pending-deprecated since matplotlib 3.11. It will be fully deprecated in 3.13 and removed in 3.15. Starting with 3.11, 'register_scale()' accepts scales without the *axis* parameter.T)messagependingN)	r  ru   rO   rP   
parametersr  r   warn_deprecatedrH   )scale_classhas_axis_parameters     r   register_scaler    sy     (3N;##$  7#4#4[#A#L#LL2Dk../ !9!9 < =4 4
 	
 r    c            	         / n [         R                  5        H\  u  p[        R                  " UR                  5      =(       d    SnU R                  SU< 3S[        R                  " US5      S/5        M^     SR                  U 5      $ )z>
Helper function for generating docstrings related to scales.
 z    z        
)	r  itemsrO   getdocr   extendtextwrapindentjoin)docsru   r  	docstrings       r   _get_scale_docsr    sv     D+113NN;#7#78>B	4(OOOIw/	
 	 4 99T?r    z{%s})
scale_type
scale_docs)8rJ   rO   r  	functoolsr   numpyr7   
matplotlibrh   r   r   matplotlib.tickerr   r   r	   r
   r   r   r   r   r   r   r   matplotlib.transformsr   r   r   rX   rZ   rw   r   r   r   r   r   r   r  r  r)  r2  r?  r\  re  ry  r  r  r  r  r  mapreprr  r  interpdregisterrstrip)ra   s   0r   <module>r     s  >      '7 7 7 7 ?W9 W9t0f*9) *9Z!;I !;H.2	 .2b&/9 &/R'9 ',@9y @9F)8 )X >i  >F&Fi &FRI9) I9X9Y 9$1Y 1d9 d9N?Y ?2?	 ?$N9 N9d !  "
#" )113t_%6785: :M
4      		O4E"F4Eq474E"FGG '')  "Fs   F>