
    hu                       S r SSKrSSK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
rSSK
JrJr  SSK
Jr  \R                   " \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\R,                  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/ S0\%5      r( " S1 S2\%5      r) " S3 S4\%5      r*SNS5 jr+ " S6 S75      r, " S8 S9\%5      r-S:SS;.S< jr.S= r/S> r0S? r1S@ r2SA r3 " SB SC\%5      r4 " SD SE\%5      r5 " SF SG\%5      r6 " SH SI\-5      r7 " SJ SK\-5      r8 " SL SM\%5      r9g)Oa  
Tick locating and formatting
============================

This module contains classes for configuring tick locating and formatting.
Generic tick locators and formatters are provided, as well as domain specific
custom ones.

Although the locators know nothing about major or minor ticks, they are used
by the Axis class to support major and minor tick locating and formatting.

.. _tick_locating:
.. _locators:

Tick locating
-------------

The Locator class is the base class for all tick locators. The locators
handle autoscaling of the view limits based on the data limits, and the
choosing of tick locations. A useful semi-automatic tick locator is
`MultipleLocator`. It is initialized with a base, e.g., 10, and it picks
axis limits and ticks that are multiples of that base.

The Locator subclasses defined here are:

======================= =======================================================
`AutoLocator`           `MaxNLocator` with simple defaults. This is the default
                        tick locator for most plotting.
`MaxNLocator`           Finds up to a max number of intervals with ticks at
                        nice locations.
`LinearLocator`         Space ticks evenly from min to max.
`LogLocator`            Space ticks logarithmically from min to max.
`MultipleLocator`       Ticks and range are a multiple of base; either integer
                        or float.
`FixedLocator`          Tick locations are fixed.
`IndexLocator`          Locator for index plots (e.g., where
                        ``x = range(len(y))``).
`NullLocator`           No ticks.
`SymmetricalLogLocator` Locator for use with the symlog norm; works like
                        `LogLocator` for the part outside of the threshold and
                        adds 0 if inside the limits.
`AsinhLocator`          Locator for use with the asinh norm, attempting to
                        space ticks approximately uniformly.
`LogitLocator`          Locator for logit scaling.
`AutoMinorLocator`      Locator for minor ticks when the axis is linear and the
                        major ticks are uniformly spaced. Subdivides the major
                        tick interval into a specified number of minor
                        intervals, defaulting to 4 or 5 depending on the major
                        interval.
======================= =======================================================

There are a number of locators specialized for date locations - see
the :mod:`.dates` module.

You can define your own locator by deriving from Locator. You must
override the ``__call__`` method, which returns a sequence of locations,
and you will probably want to override the autoscale method to set the
view limits from the data limits.

If you want to override the default locator, use one of the above or a custom
locator and pass it to the x- or y-axis instance. The relevant methods are::

  ax.xaxis.set_major_locator(xmajor_locator)
  ax.xaxis.set_minor_locator(xminor_locator)
  ax.yaxis.set_major_locator(ymajor_locator)
  ax.yaxis.set_minor_locator(yminor_locator)

The default minor locator is `NullLocator`, i.e., no minor ticks on by default.

.. note::
    `Locator` instances should not be used with more than one
    `~matplotlib.axis.Axis` or `~matplotlib.axes.Axes`. So instead of::

        locator = MultipleLocator(5)
        ax.xaxis.set_major_locator(locator)
        ax2.xaxis.set_major_locator(locator)

    do the following instead::

        ax.xaxis.set_major_locator(MultipleLocator(5))
        ax2.xaxis.set_major_locator(MultipleLocator(5))

.. _formatters:

Tick formatting
---------------

Tick formatting is controlled by classes derived from Formatter. The formatter
operates on a single tick value and returns a string to the axis.

========================= =====================================================
`NullFormatter`           No labels on the ticks.
`FixedFormatter`          Set the strings manually for the labels.
`FuncFormatter`           User defined function sets the labels.
`StrMethodFormatter`      Use string `format` method.
`FormatStrFormatter`      Use an old-style sprintf format string.
`ScalarFormatter`         Default formatter for scalars: autopick the format
                          string.
`LogFormatter`            Formatter for log axes.
`LogFormatterExponent`    Format values for log axis using
                          ``exponent = log_base(value)``.
`LogFormatterMathtext`    Format values for log axis using
                          ``exponent = log_base(value)`` using Math text.
`LogFormatterSciNotation` Format values for log axis using scientific notation.
`LogitFormatter`          Probability formatter.
`EngFormatter`            Format labels in engineering notation.
`PercentFormatter`        Format labels as a percentage.
========================= =====================================================

You can derive your own formatter from the Formatter base class by
simply overriding the ``__call__`` method. The formatter class has
access to the axis view and data limits.

To control the major and minor tick label formats, use one of the
following methods::

  ax.xaxis.set_major_formatter(xmajor_formatter)
  ax.xaxis.set_minor_formatter(xminor_formatter)
  ax.yaxis.set_major_formatter(ymajor_formatter)
  ax.yaxis.set_minor_formatter(yminor_formatter)

In addition to a `.Formatter` instance, `~.Axis.set_major_formatter` and
`~.Axis.set_minor_formatter` also accept a ``str`` or function.  ``str`` input
will be internally replaced with an autogenerated `.StrMethodFormatter` with
the input ``str``. For function input, a `.FuncFormatter` with the input
function will be generated and used.

See :doc:`/gallery/ticks/major_minor_demo` for an example of setting major
and minor ticks. See the :mod:`matplotlib.dates` module for more information
and examples of using date locators and formatters.
    N)Integral)_apicbook)
transforms)
TickHelper	FormatterFixedFormatterNullFormatterFuncFormatterFormatStrFormatterStrMethodFormatterScalarFormatterLogFormatterLogFormatterExponentLogFormatterMathtextLogFormatterSciNotationLogitFormatterEngFormatterPercentFormatterLocatorIndexLocatorFixedLocatorNullLocatorLinearLocator
LogLocatorAutoLocatorMultipleLocatorMaxNLocatorAutoMinorLocatorSymmetricalLogLocatorAsinhLocatorLogitLocatorc                   F    \ rS rSrSr SS jrS rS rS rS rS r	S	 r
S
rg)
_DummyAxis   dummyc                 ,    SU l         SU l        Xl        g )N)r      )_data_interval_view_interval_minpos)selfminposs     C/var/www/html/env/lib/python3.13/site-packages/matplotlib/ticker.py__init___DummyAxis.__init__   s    $$    c                     U R                   $ Nr*   r,   s    r.   get_view_interval_DummyAxis.get_view_interval       """r1   c                     X4U l         g r3   r4   r,   vminvmaxs      r.   set_view_interval_DummyAxis.set_view_interval       #lr1   c                     U R                   $ r3   )r+   r5   s    r.   
get_minpos_DummyAxis.get_minpos   s    ||r1   c                     U R                   $ r3   r)   r5   s    r.   get_data_interval_DummyAxis.get_data_interval   r8   r1   c                     X4U l         g r3   rD   r:   s      r.   set_data_interval_DummyAxis.set_data_interval   r?   r1   c                     g)N	    r5   s    r.   get_tick_space_DummyAxis.get_tick_space   s    r1   )r)   r+   r*   Nr   )__name__
__module____qualname____firstlineno__r/   r6   r=   rA   rE   rH   rM   __static_attributes__rL   r1   r.   r$   r$      s*    H
#+#+r1   r$   c                   $    \ rS rSrSrS rS rSrg)r      Nc                     Xl         g r3   axis)r,   rY   s     r.   set_axisTickHelper.set_axis   s    	r1   c                 @    U R                   c  [        S0 UD6U l         g g )NrL   )rY   r$   r,   kwargss     r.   create_dummy_axisTickHelper.create_dummy_axis   s     99",V,DI r1   rX   )rP   rQ   rR   rS   rY   rZ   r_   rT   rL   r1   r.   r   r      s    D-r1   r   c                   Z    \ rS rSrSr/ rSS jrS rS rS r	S r
S	 r\S
 5       rS rSrg)r      z5
Create a string based on a tick value and location.
Nc                     [        S5      e)zg
Return the format for tick value *x* at position pos.
``pos=None`` indicates an unspecified location.
Derived must overrideNotImplementedErrorr,   xposs      r.   __call__Formatter.__call__   s    
 ""9::r1   c                 |    U R                  U5        [        U5       VVs/ s H  u  p#U " X25      PM     snn$ s  snnf )z1Return the tick labels for all the ticks at once.)set_locs	enumerate)r,   valuesivalues       r.   format_ticksFormatter.format_ticks   s3    f/8/@A/@81U/@AAAs   8c                 $    U R                  U5      $ )zS
Return the full string representation of the value with the
position unspecified.
)rj   r,   rq   s     r.   format_dataFormatter.format_data   s    
 }}U##r1   c                 $    U R                  U5      $ )zd
Return a short string version of the tick value.

Defaults to the position-independent long value.
rv   ru   s     r.   format_data_shortFormatter.format_data_short   s     &&r1   c                     gN rL   r5   s    r.   
get_offsetFormatter.get_offset   s    r1   c                     Xl         g)z
Set the locations of the ticks.

This method is called before computing the tick labels because some
formatters need to know all tick locations to do so.
Nlocsr,   r   s     r.   rm   Formatter.set_locs   s	     	r1   c                 Z    [         R                  S   (       a  U R                  SS5      $ U $ )z
Some classes may want to replace a hyphen for minus with the proper
Unicode symbol (U+2212) for typographical correctness.  This is a
helper method to perform such a replacement when it is enabled via
:rc:`axes.unicode_minus`.
zaxes.unicode_minus-u   −)mplrcParamsreplace)ss    r.   	fix_minusFormatter.fix_minus   s/     << 45 		#/0 		r1   c                     g)z6Subclasses may want to override this to set a locator.NrL   )r,   locators     r.   _set_locatorFormatter._set_locator  s    r1   r   r3   )rP   rQ   rR   rS   __doc__r   rj   rr   rv   rz   r   rm   staticmethodr   r   rT   rL   r1   r.   r   r      sF    
 D;B
$' 	 	r1   r   c                   "    \ rS rSrSrSS jrSrg)r
   i  zAlways return the empty string.Nc                     gr}   rL   rg   s      r.   rj   NullFormatter.__call__
  s    r1   rL   r3   )rP   rQ   rR   rS   r   rj   rT   rL   r1   r.   r
   r
     s
    )r1   r
   c                   4    \ rS rSrSrS rS	S jrS rS rSr	g)
r	   i  z
Return fixed strings for tick labels based only on position, not value.

.. note::
    `.FixedFormatter` should only be used together with `.FixedLocator`.
    Otherwise, the labels may end up in unexpected positions.
c                     Xl         SU l        g)z?Set the sequence *seq* of strings that will be used for labels.r~   N)seqoffset_string)r,   r   s     r.   r/   FixedFormatter.__init__  s    r1   Nc                 Z    Ub  U[        U R                  5      :  a  gU R                  U   $ )z
Return the label that matches the position, regardless of the value.

For positions ``pos < len(seq)``, return ``seq[i]`` regardless of
*x*. Otherwise return empty string. ``seq`` is the sequence of
strings that this object was initialized with.
r~   )lenr   rg   s      r.   rj   FixedFormatter.__call__  s)     ;#TXX.88C= r1   c                     U R                   $ r3   r   r5   s    r.   r   FixedFormatter.get_offset*      !!!r1   c                     Xl         g r3   r   r,   ofss     r.   set_offset_string FixedFormatter.set_offset_string-       r1   )r   r   r3   
rP   rQ   rR   rS   r   r/   rj   r   r   rT   rL   r1   r.   r	   r	     s     
!"!r1   r	   c                   4    \ rS rSrSrS rS	S jrS rS rSr	g)
r   i1  z
Use a user-defined function for formatting.

The function should take in two inputs (a tick value ``x`` and a
position ``pos``), and return a string containing the corresponding
tick label.
c                     Xl         SU l        g r}   funcr   )r,   r   s     r.   r/   FuncFormatter.__init__:  s    	r1   Nc                 $    U R                  X5      $ )zY
Return the value of the user defined function.

*x* and *pos* are passed through as-is.
)r   rg   s      r.   rj   FuncFormatter.__call__>  s     yy  r1   c                     U R                   $ r3   r   r5   s    r.   r   FuncFormatter.get_offsetF  r   r1   c                     Xl         g r3   r   r   s     r.   r   FuncFormatter.set_offset_stringI  r   r1   r   r3   r   rL   r1   r.   r   r   1  s     !"!r1   r   c                   (    \ rS rSrSrS rSS jrSrg)r   iM  ak  
Use an old-style ('%' operator) format string to format the tick.

The format string should have a single variable format (%) in it.
It will be applied to the value (not the position) of the tick.

Negative numeric values (e.g., -1) will use a dash, not a Unicode minus;
use mathtext to get a Unicode minus by wrapping the format specifier with $
(e.g. "$%g$").
c                     Xl         g r3   fmtr,   r   s     r.   r/   FormatStrFormatter.__init__Y      r1   Nc                      U R                   U-  $ )z_
Return the formatted label string.

Only the value *x* is formatted. The position is ignored.
r   rg   s      r.   rj   FormatStrFormatter.__call__\  s     xx!|r1   r   r3   rP   rQ   rR   rS   r   r/   rj   rT   rL   r1   r.   r   r   M  s    	r1   r   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )_UnicodeMinusFormatie  a  
A specialized string formatter so that `.StrMethodFormatter` respects
:rc:`axes.unicode_minus`.  This implementation relies on the fact that the
format string is only ever called with kwargs *x* and *pos*, so it blindly
replaces dashes by unicode minuses without further checking.
c                 H   > [         R                  [        TU ]  X5      5      $ r3   )r   r   superformat_field)r,   rq   format_spec	__class__s      r.   r    _UnicodeMinusFormat.format_fieldm  s    ""57#7#KLLr1   rL   )rP   rQ   rR   rS   r   r   rT   __classcell__r   s   @r.   r   r   e  s    M Mr1   r   c                   (    \ rS rSrSrS rSS jrSrg)r   iq  a  
Use a new-style format string (as used by `str.format`) to format the tick.

The field used for the tick value must be labeled *x* and the field used
for the tick position must be labeled *pos*.

The formatter will respect :rc:`axes.unicode_minus` when formatting
negative numeric values.

It is typically unnecessary to explicitly construct `.StrMethodFormatter`
objects, as `~.Axis.set_major_formatter` directly accepts the format string
itself.
c                     Xl         g r3   r   r   s     r.   r/   StrMethodFormatter.__init__  r   r1   Nc                 F    [        5       R                  U R                  XS9$ )z{
Return the formatted label string.

*x* and *pos* are passed to `str.format` as keyword arguments
with those exact names.
)rh   ri   )r   formatr   rg   s      r.   rj   StrMethodFormatter.__call__  s!     #$++DHH+CCr1   r   r3   r   rL   r1   r.   r   r   q  s    Dr1   r   c                       \ rS rSrSrSSS.S jjrS rS r\" \\S9r	S	 r
S
 r\" \
\S9rS rS r\" \\S9rS rS rS r\" \\S9rSS jrS rS rS rS rS rS rS rS rS rSrg)r   i  a  
Format tick values as a number.

Parameters
----------
useOffset : bool or float, default: :rc:`axes.formatter.useoffset`
    Whether to use offset notation. See `.set_useOffset`.
useMathText : bool, default: :rc:`axes.formatter.use_mathtext`
    Whether to use fancy math formatting. See `.set_useMathText`.
useLocale : bool, default: :rc:`axes.formatter.use_locale`.
    Whether to use locale settings for decimal sign and positive sign.
    See `.set_useLocale`.
usetex : bool, default: :rc:`text.usetex`
    To enable/disable the use of TeX's math mode for rendering the
    numbers in the formatter.

    .. versionadded:: 3.10

Notes
-----
In addition to the parameters above, the formatting of scientific vs.
floating point representation can be configured via `.set_scientific`
and `.set_powerlimits`).

**Offset notation and scientific notation**

Offset notation and scientific notation look quite similar at first sight.
Both split some information from the formatted tick values and display it
at the end of the axis.

- The scientific notation splits up the order of magnitude, i.e. a
  multiplicative scaling factor, e.g. ``1e6``.

- The offset notation separates an additive constant, e.g. ``+1e6``. The
  offset notation label is always prefixed with a ``+`` or ``-`` sign
  and is thus distinguishable from the order of magnitude label.

The following plot with x limits ``1_000_000`` to ``1_000_010`` illustrates
the different formatting. Note the labels at the right edge of the x axis.

.. plot::

    lim = (1_000_000, 1_000_010)

    fig, (ax1, ax2, ax3) = plt.subplots(3, 1, gridspec_kw={'hspace': 2})
    ax1.set(title='offset notation', xlim=lim)
    ax2.set(title='scientific notation', xlim=lim)
    ax2.xaxis.get_major_formatter().set_useOffset(False)
    ax3.set(title='floating-point notation', xlim=lim)
    ax3.xaxis.get_major_formatter().set_useOffset(False)
    ax3.xaxis.get_major_formatter().set_scientific(False)

N)usetexc                B   Uc  [         R                  S   n[         R                  S   U l        U R                  U5        U R	                  U5        U R                  U5        SU l        SU l        SU l        [         R                  S   U l	        U R                  U5        g )Nzaxes.formatter.useoffsetzaxes.formatter.offset_thresholdr   r~   Tzaxes.formatter.limits)r   r   _offset_thresholdset_useOffset
set_usetexset_useMathTextorderOfMagnituder   _scientific_powerlimitsset_useLocale)r,   	useOffsetuseMathText	useLocaler   s        r.   r/   ScalarFormatter.__init__  s    %?@ILL:; 	9%[) !LL)@A9%r1   c                     U R                   $ )z8Return whether TeX's math mode is enabled for rendering.)_usetexr5   s    r.   
get_usetexScalarFormatter.get_usetex  s    ||r1   c                 <    [         R                  " US5      U l        g)zJSet whether to use TeX's math mode for rendering numbers in the formatter.text.usetexN)r   
_val_or_rcr   r,   vals     r.   r   ScalarFormatter.set_usetex  s    ~~c=9r1   )fgetfsetc                     U R                   $ )z
Return whether automatic mode for offset notation is active.

This returns True if ``set_useOffset(True)``; it returns False if an
explicit offset was set, e.g. ``set_useOffset(1000)``.

See Also
--------
ScalarFormatter.set_useOffset
)
_useOffsetr5   s    r.   get_useOffsetScalarFormatter.get_useOffset  s     r1   c                 F    US;   a  SU l         Xl        gSU l        Xl         g)a5  
Set whether to use offset notation.

When formatting a set numbers whose value is large compared to their
range, the formatter can separate an additive constant. This can
shorten the formatted numbers so that they are less likely to overlap
when drawn on an axis.

Parameters
----------
val : bool or float
    - If False, do not use offset notation.
    - If True (=automatic mode), use offset notation if it can make
      the residual numbers significantly shorter. The exact behavior
      is controlled by :rc:`axes.formatter.offset_threshold`.
    - If a number, force an offset of the given value.

Examples
--------
With active offset notation, the values

``100_000, 100_002, 100_004, 100_006, 100_008``

will be formatted as ``0, 2, 4, 6, 8`` plus an offset ``+1e5``, which
is written to the edge of the axis.
)TFr   FN)offsetr   r   s     r.   r   ScalarFormatter.set_useOffset  s$    6 -DK!O#DOKr1   c                     U R                   $ )zj
Return whether locale settings are used for formatting.

See Also
--------
ScalarFormatter.set_useLocale
)
_useLocaler5   s    r.   get_useLocaleScalarFormatter.get_useLocale  s     r1   c                 H    Uc  [         R                  S   U l        gXl        g)z
Set whether to use locale settings for decimal sign and positive sign.

Parameters
----------
val : bool or None
    *None* resets to :rc:`axes.formatter.use_locale`.
Nzaxes.formatter.use_locale)r   r   r   r   s     r.   r   ScalarFormatter.set_useLocale  s     ;!ll+FGDO!Or1   c                   ^ U R                  U R                  (       a]  U R                  (       a.  SR                  U4S jUR	                  S5       5       5      5      $ [
        R                  " UT4S5       5      $ UT-  5      $ )zH
Format *arg* with *fmt*, applying Unicode minus and locale if desired.
,c              3   v   >#    U  H.  n[         R                  " UT4S 5      R                  SS5      v   M0     g7f)Tr   z{,}N)localeformat_stringr   ).0partargs     r.   	<genexpr>AScalarFormatter._format_maybe_minus_and_locale.<locals>.<genexpr>/  s:      6&4d !..tcVTBJJ3PUVV&4s   69T)r   r   _useMathTextjoinsplitr   r   )r,   r   r   s     `r.   _format_maybe_minus_and_locale.ScalarFormatter._format_maybe_minus_and_locale(  s     ~~ ?? :>9J9J  6&)iin6 6  	 
 **3=  	  3Y  	 r1   c                     U R                   $ )za
Return whether to use fancy math formatting.

See Also
--------
ScalarFormatter.set_useMathText
)r  r5   s    r.   get_useMathTextScalarFormatter.get_useMathText5  s        r1   c                 j   Uc  [         R                  S   U l        U R                  SL ap   SSKJn  UR                  UR                  [         R                  S   S9SS9nU[        [        R                  " S	5      5      :X  a  [        R                  " S
5        gggXl        g! [         a    Sn NQf = f)z
Set whether to use fancy math formatting.

If active, scientific notation is formatted as :math:`1.2 \times 10^3`.

Parameters
----------
val : bool or None
    *None* resets to :rc:`axes.formatter.use_mathtext`.
Nzaxes.formatter.use_mathtextFr   )font_managerzfont.family)family)fallback_to_defaultzfonts/ttf/cmr10.ttfzXcmr10 font should ideally be used with mathtext, set axes.formatter.use_mathtext to True)r   r   r  
matplotlibr
  findfontFontProperties
ValueErrorstrr   _get_data_pathr   warn_external)r,   r   r
  ufonts       r.   r   ScalarFormatter.set_useMathText?  s     ; #-J KD  E)	!7(11$33#&<<#> 4  -2	 2 E C 4 45J KLL&&L M *$ !$ " ! E!s   4B# #B21B2c                     [        U R                  5      S:X  a  gXR                  -
  SU R                  -  -  n[	        U5      S:  a  SnU R                  U R                  U5      $ )z9
Return the format for tick value *x* at position *pos*.
r   r~         $@:0yE>)r   r   r   r   absr  r   r,   rh   ri   xps       r.   rj   ScalarFormatter.__call__b  sY     tyy>Qkk/cT-B-B&BCB2w~66t{{BGGr1   c                 $    [        U5      U l        g)zX
Turn scientific notation on or off.

See Also
--------
ScalarFormatter.set_powerlimits
N)boolr   )r,   bs     r.   set_scientificScalarFormatter.set_scientificn  s      7r1   c                 D    [        U5      S:w  a  [        S5      eXl        g)aa  
Set size thresholds for scientific notation.

Parameters
----------
lims : (int, int)
    A tuple *(min_exp, max_exp)* containing the powers of 10 that
    determine the switchover threshold. For a number representable as
    :math:`a \times 10^\mathrm{exp}` with :math:`1 <= |a| < 10`,
    scientific notation will be used if ``exp <= min_exp`` or
    ``exp >= max_exp``.

    The default limits are controlled by :rc:`axes.formatter.limits`.

    In particular numbers with *exp* equal to the thresholds are
    written in scientific notation.

    Typically, *min_exp* will be negative and *max_exp* will be
    positive.

    For example, ``formatter.set_powerlimits((-3, 4))`` will provide
    the following formatting:
    :math:`1 \times 10^{-3}, 9.9 \times 10^{-3}, 0.01,`
    :math:`9999, 1 \times 10^4`.

See Also
--------
ScalarFormatter.set_scientific
   z%'lims' must be a sequence of length 2N)r   r  r   )r,   limss     r.   set_powerlimitsScalarFormatter.set_powerlimitsx  s!    < t9>DEE r1   c                 R   U[         R                  R                  L a  g[        U[        5      (       a  SnGO`[        U R                  SS5      S;   Ga  U R                  R                  S:X  ai  U R                  R                  R                  5       nUR                  5       nUR                  US45      nUR                  USS/SS//-   5      S S 2S4   nOhU R                  R                  R                  5       nUR                  5       nUR                  SU45      nUR                  USS/SS//-   5      S S 2S4   n[        Xa-
  5      R                  5       nO#U R                  R                  5       u  pX-
  S	-  nS
[         R"                  " X5       S3nU R%                  X!5      $ )Nr~   %drP   )xaxisyaxisr)  r   r(        @z%-#.g)npmamasked
isinstancer   getattrrY   rP   axesget_xaxis_transforminverted	transformget_yaxis_transformr  maxr6   r   _g_sig_digitsr  )
r,   rq   r   axis_trfaxis_inv_trf	screen_xyneighbor_valuesdeltaar  s
             r.   rz   !ScalarFormatter.format_data_short  s   BEELL eX&&Ctyy*b15GG99%%0#yy~~AACH#+#4#4#6L ( 2 2E1: >I&2&<&<!b!Wr1g$66'8891'>O  $yy~~AACH#+#4#4#6L ( 2 2Au: >I&2&<&<!aWq"g$66'8891'>OO3488: yy224#,,U:;1=C223>>r1   c                 t   [         R                  " [         R                  " [        U5      5      5      n[	        USU-  -  S5      nU R                  US-  S:X  a  SOSU5      nUS:X  a  U$ U R                  SU5      nU R                  (       d  U R                  (       a  SU-  nUS:X  a  U$ U SU 3$ U SU 3$ )	N
   r(   r   r(  z%1.10gz10^{%s}z \times e)mathfloorlog10r  roundr  r  r   )r,   rq   rC  r   significandexponents         r.   rv   ScalarFormatter.format_data  s    JJtzz#e*-.%"a%-$99EQJDHa1666tQ? 8+H !QH >(M(<> "]!H:..r1   c                 ~   [        U R                  5      S:X  a  gU R                  (       d  U R                  (       Ga   SnSnU R                  (       a0  U R	                  U R                  5      nU R                  S:  a  SU-   nU R                  (       aP  U R
                  (       d  U R                  (       a  U R	                  SU R                  -  5      nOSU R                  -  nU R                  (       d  U R
                  (       a  US:w  a  SU-  nSU SU S	3nOSR                  X!45      nU R                  U5      $ g)
z*
Return scientific notation, plus offset.
r   r~   +rB  z1e%dz\times\mathdefault{%s}$z\mathdefault{z}$)	r   r   r   r   rv   r   r  r  r   r,   	offsetStr	sciNotStrr   s       r.   r   ScalarFormatter.get_offset  s     tyy>Q  DKKKII{{ ,,T[[9	;;? #iI$$<<4#4#4 $ 0 0t7L7L1L MI &)>)> >I  DLL? 9I EI>)C@GGY23>>!$$r1   c                     Xl         [        U R                   5      S:  aB  U R                  (       a  U R                  5         U R	                  5         U R                  5         g g )Nr   )r   r   r   _compute_offset_set_order_of_magnitude_set_formatr   s     r.   rm   ScalarFormatter.set_locs  sG    	tyy>A$$&((*	 r1   c                   ^
^ U R                   n[        U R                  R                  5       5      u  p#[        R
                  " U5      nXU:*  X:*  -     n[        U5      (       d  SU l        g UR                  5       UR                  5       pTXE:X  d  USs=::  a  U::  a  O  OSU l        g [        [        [        U5      5      [        [        U5      5      /5      u  mm
[        R                  " SU5      n[        R                  " [        R                  " T
5      5      nS[!        U
U4S j["        R$                  " US5       5       5      -   nT
T-
  SU-  -  S::  a.  S[!        U
U4S j["        R$                  " US5       5       5      -   nU R&                  S-
  n	T
SU-  -  SU	-  :  a  UT
SU-  -  -  SU-  -  U l        g SU l        g )Nr   r(   c              3   P   >#    U  H  nTS U-  -  TS U-  -  :w  d  M  Uv   M     g7f)rB  NrL   r   oomabs_maxabs_mins     r.   r   2ScalarFormatter._compute_offset.<locals>.<genexpr>  s5      H&Bs!R3Y.'R3Y2FF s&Bs   &	&r+  rB  {Gz?c              3   V   >#    U  H  nTS U-  -  TS U-  -  -
  S:  d  M  Uv   M      g7f)rB  r(   NrL   rY  s     r.   r   r]  	  s:      O*F3%s2Wc	5IIAM 3*Fs   )	))r   sortedrY   r6   r.  asarrayr   r   minr8  r  floatrD  copysignceilrF  next	itertoolscountr   )r,   r   r;   r<   lminlmaxsignoom_maxrZ  nr[  r\  s             @@r.   rS  ScalarFormatter._compute_offset  s   yyDII779:
zz$T\dl344yyDKXXZd <41,,DK "3uT{#3St5E"FG}}Q%
 ''$**W-.$ Hioogr&B H H Hgs*d2
 d O)//'2*F O O OC ""Q&!R3Y."a%7 w")34rSy@ 	r1   c                 &   U R                   (       d  SU l        g U R                  S   U R                  S   s=:X  a  S:w  a  O  OU R                  S   U l        g [        U R                  R                  5       5      u  p[        R                  " U R                  5      nX1U:*  X2:*  -     n[        R                  " U5      n[        U5      (       d  SU l        g U R                  (       a-  [        R                  " [        R                  " X!-
  5      5      nOCUR                  5       nUS:X  a  SnO*[        R                  " [        R                  " U5      5      nX@R                  S   ::  a  X@l        g X@R                  S   :  a  X@l        g SU l        g Nr   r(   )r   r   r   r`  rY   r6   r.  ra  r   r  r   r   rD  rE  rF  r8  )r,   r;   r<   r   rZ  r   s         r.   rT  'ScalarFormatter._set_order_of_magnitude  s3    $%D!Q4#4#4Q#7<1<$($5$5a$8D!DII779:
zz$))$T\dl34vvd|4yy$%D!;;**TZZ45C((*CaxjjC1##A&&$'!%%a(($'!$%D!r1   c                    [        U R                  5      S:  a)  / U R                  QU R                  R                  5       QnOU R                  n[        R
                  " U5      U R                  -
  SU R                  -  -  n[        R                  " U5      nUS:X  a*  [        R                  " [        R                  " U5      5      nUS:X  a  Sn[        U R                  5      S:  a  US S n[        [        R                  " [        R                  " U5      5      5      n[        SSU-
  5      nSSU-  -  nUS:  aL  [        R                  " U[        R                  " X%S	9-
  5      R                  5       U:  a  US-  nOOUS:  a  ML  US-  nS
U S3U l        U R"                  (       d  U R$                  (       a  SU R                   -  U l        g g )Nr#  r  r   r(      MbP?rB  )decimalsz%1.f$\mathdefault{%s}$)r   r   rY   r6   r.  ra  r   r   ptpr8  r  intrD  rE  rF  rG  r   r   r  )r,   _locsr   	loc_rangeloc_range_oomsigfigsthreshs          r.   rU  ScalarFormatter._set_format3  sr   tyy>A@dii@$))"="="?@EIIE

5!DKK/3$:O:O3OOFF4L	>rvvd|,I>Ityy>A9DDJJtzz)'<=>a]*+m++lvvdRXXd==>BBDvM1	 l
 	1G9A&<<4,,/$++=DK -r1   )r   r   r   r   r  r   r   r   r   r   r   )NNNr3   )rP   rQ   rR   rS   r   r/   r   r   propertyr   r   r   r   r   r   r   r  r  r   r   rj   r   r%  rz   rv   r   rm   rS  rT  rU  rT   rL   r1   r.   r   r     s    4l&&: :J7F D m-@I" m-@I !$B oFK
H# !D?8/ 6%N &D>r1   r   c                   `    \ rS rSrSr   SS jrS rS rSS jrS r	SS	 jr
S
 rS rS rSrg)r   iU  a/  
Base class for formatting ticks on a log or symlog scale.

It may be instantiated directly, or subclassed.

Parameters
----------
base : float, default: 10.
    Base of the logarithm used in all calculations.

labelOnlyBase : bool, default: False
    If True, label ticks only at integer powers of base.
    This is normally True for major ticks and False for
    minor ticks.

minor_thresholds : (subset, all), default: (1, 0.4)
    If labelOnlyBase is False, these two numbers control
    the labeling of ticks that are not at integer powers of
    base; normally these are the minor ticks. The controlling
    parameter is the log of the axis data range.  In the typical
    case where base is 10 it is the number of decades spanned
    by the axis, so we can call it 'numdec'. If ``numdec <= all``,
    all minor ticks will be labeled.  If ``all < numdec <= subset``,
    then only a subset of minor ticks will be labeled, so as to
    avoid crowding. If ``numdec > subset`` then no minor ticks will
    be labeled.

linthresh : None or float, default: None
    If a symmetric log scale is in use, its ``linthresh``
    parameter must be supplied here.

Notes
-----
The `set_locs` method must be called to enable the subsetting
logic controlled by the ``minor_thresholds`` parameter.

In some cases such as the colorbar, there is no distinction between
major and minor ticks; the tick locations might be set manually,
or by a locator that puts ticks at integer powers of base and
at intermediate locations.  For this situation, disable the
minor_thresholds logic by using ``minor_thresholds=(np.inf, np.inf)``,
so that all ticks will be labeled.

To disable labeling of minor ticks when 'labelOnlyBase' is False,
use ``minor_thresholds=(0, 0)``.  This is the default for the
"classic" style.

Examples
--------
To label a subset of minor ticks when the view limits span up
to 2 decades, and all of the ticks when zoomed in to 0.5 decades
or less, use ``minor_thresholds=(2, 0.5)``.

To label all minor ticks when the view limits span up to 1.5
decades, use ``minor_thresholds=(1.5, 1.5)``.
Nc                     U R                  U5        U R                  U5        Uc  [        R                  S   (       a  SnOSnX0l        S U l        X@l        g )N_internal.classic_moder   r   )r(   g?)set_baseset_label_minorr   r   minor_thresholds
_sublabels
_linthresh)r,   baselabelOnlyBaser  	linthreshs        r.   r/   LogFormatter.__init__  sO     	d]+#||45#) #+  0#r1   c                 $    [        U5      U l        g)zl
Change the *base* for labeling.

.. warning::
   Should always match the base used for :class:`LogLocator`
N)rc  _base)r,   r  s     r.   r  LogFormatter.set_base  s     4[
r1   c                     Xl         g)z
Switch minor tick labeling on or off.

Parameters
----------
labelOnlyBase : bool
    If True, label ticks only at integer powers of base.
Nr  )r,   r  s     r.   r  LogFormatter.set_label_minor  s
     +r1   c                    [         R                  " U R                  S   5      (       a  SU l        gU R                  nUc%   U R
                  R                  5       R                  nU R
                  R                  5       u  p4X4:  a  XCpCUc  US::  a	  S1U l        gU R                  nUb  SnX2* :  a>  [        XB* 5      nU[        R                  " X7-  5      [        R                  " U5      -  -  nXB:  a=  [        X25      nU[        R                  " XH-  5      [        R                  " U5      -  -  nOg[        R                  " U5      [        R                  " U5      -  n[        R                  " U5      [        R                  " U5      -  n[        XC-
  5      nX`R                  S   :  a	  S1U l        gX`R                  S   :  aL  [         R                   " SU[#        U5      S-  S-   5      n	[%        [         R&                  " U	5      5      U l        g[%        [         R(                  " SUS-   5      5      U l        g! [         a     GNf = f)zu
Use axis view limits to control which ticks are labeled.

The *locs* parameter is ignored in the present algorithm.
r   Nr(   r#  )r.  isinfr  r  r  rY   get_transformr  AttributeErrorr6   r  rb  rD  logr8  r  	geomspacerz  setrG  arange)
r,   r   r  r;   r<   r  numdecrhslhscs
             r.   rm   LogFormatter.set_locs  s    88D))!,--"DO OO	 II335??	 YY002
;$  !cDOJJ  Fj $
+$((4:.!<<$*$((4:.!<<88D>DHHQK/D88D>DHHQK/D%F))!,, cDO++A.. Q3q619q=1A!"((1+.DO ""))Aq1u"56DOU " s   $H; ;
I	I	c                 R    SUs=::  a  S::  a  O  OU R                  XU-
  5      $ US $ )Nr(   '  z1.0e)_pprint_val)r,   rh   r;   r<   s       r.   _num_to_stringLogFormatter._num_to_string  s*    34?U?t$;/S1T(Sr1   c                 6   US:X  a  g[        U5      nU R                  n[        R                  " U5      [        R                  " U5      -  n[	        U5      nU(       a  [        U5      O[        R                  " U5      n[        X4U-
  -  5      nU R                  (       a  U(       d  gU R                  b  XpR                  ;  a  gU R                  R                  5       u  p[        R                  " XSS9u  pU R                  XU	5      n
U R                  U
5      $ )N        0r~   皙?expander)r  r  rD  r  _is_close_to_intrG  r.  rE  r  r  rY   r6   mtransformsnonsingularr  r   )r,   rh   ri   r  fxis_x_decaderI  coeffr;   r<   r   s              r.   rj   LogFormatter.__call__  s    8FJJXXa[488A;&&r* +59"aM*+k??&5+GYY002
 ,,T$G
.~~a  r1   c                     [         R                  " U SS9   [         R                  " U R                  U5      5      sS S S 5        $ ! , (       d  f       g = f)NFr  )r   _setattr_cm
strip_mathrj   ru   s     r.   rv   LogFormatter.format_data  s5    t59##DMM%$89 :99s   %A
Ac                 (    SU-  R                  5       $ )Nz%-12g)rstripru   s     r.   rz   LogFormatter.format_data_short  s    %''))r1   c                    [        U5      S:  a  U[        U5      :X  a  SU-  $ US:  a  SOUS::  a  SOUS::  a  SO	US	::  a  S
OSnX1-  nUR                  S5      n[        U5      S:X  aE  US   R	                  S5      R	                  S5      n[        US   5      nU(       a  SXg4-  nU$ Un U$ UR	                  S5      R	                  S5      nU$ )Nr,  r(  r^  z%1.3er(   z%1.3frB  z%1.2fg     j@z%1.1fz%1.1erC  r#  r   r  .z%se%d)r  rz  r  r   r  )r,   rh   dr   r   tupmantissarI  s           r.   r  LogFormatter._pprint_val  s    q6C<AQK!8Od(wq&wr'ws(w	 	
 Gggcls8q=1v}}S)005H3q6{Hx22
    $$S)Ar1   )r  r  r  r  r  )r  FNNr3   )rP   rQ   rR   rS   r   r/   r  r  rm   r  rj   rv   rz   r  rT   rL   r1   r.   r   r   U  sB    7r 16"&$!	+97vT!.:*r1   r   c                       \ rS rSrSrS rSrg)r   i&  B
Format values for log axis using ``exponent = log_base(value)``.
c                 F   [         R                  " U5      [         R                  " U R                  5      -  nS[        U5      s=::  a  S::  aO  O  OL[         R                  " X2-
  5      [         R                  " U R                  5      -  nU R	                  XE5      nU$ US nU$ )Nr(   r  z1.0g)rD  r  r  r  r  )r,   rh   r;   r<   r  fdr   s          r.   r  #LogFormatterExponent._num_to_string+  s{    XXa[488DJJ//B 5 $+&$**)==B  (A  d)Ar1   rL   N)rP   rQ   rR   rS   r   r  rT   rL   r1   r.   r   r   &  s    r1   r   c                   (    \ rS rSrSrS rSS jrSrg)r   i5  r  c                     SXU4-  $ )'Return string for non-decade locations.z$\mathdefault{%s%s^{%.2f}}$rL   )r,   sign_stringr  r  r   s        r.   _non_decade_format'LogFormatterMathtext._non_decade_format:  s    -B0GGGr1   Nc                    US:X  a  gUS:  a  SOSn[        U5      nU R                  n[        R                  " U5      [        R                  " U5      -  n[	        U5      nU(       a  [        U5      O[        R                  " U5      n[        XEU-
  -  5      nU R                  (       a  U(       d  gU R                  b  XR                  ;  a  gU(       a  [        U5      nUS-  S:X  a  SU-  n	OSU-  n	[        U5      [        R                  S	   :  a  S
X14-  $ U(       d%  [        R                  S   n
U R                  X9XZ5      $ SX9U4-  $ )Nr   z$\mathdefault{0}$r   r~   r(   r  r(  z%szaxes.formatter.min_exponentz$\mathdefault{%s%g}$r   z$\mathdefault{%s%s^{%d}}$)r  r  rD  r  r  rG  r.  rE  r  r  r   r   r  )r,   rh   ri   r  r  r  r  rI  r  r  r   s              r.   rj   LogFormatterMathtext.__call__>  s   6'UcFJJ XXa[488A;&&r* +59"aM*+k??&5+GrB q5C<!8D!8Dr7S\\"?@@*k-===\\-0F**;bII/;b2IIIr1   rL   r3   )rP   rQ   rR   rS   r   r  rj   rT   rL   r1   r.   r   r   5  s    H#Jr1   r   c                       \ rS rSrSrS rSrg)r   id  zD
Format values following scientific notation in a logarithmic axis.
c                     [        U5      n[        R                  " U5      nXSU-
  -  n[        U5      (       a  [	        U5      nSXX&4-  $ )r  z!$\mathdefault{%s%g\times%s^{%d}}$)rc  rD  rE  r  rG  )r,   r  r  r  r   r  rI  r  s           r.   r  *LogFormatterSciNotation._non_decade_formati  sM    $K::b>8m$E""%LE3423 	3r1   rL   N)rP   rQ   rR   rS   r   r  rT   rL   r1   r.   r   r   d  s    3r1   r   c                   l    \ rS rSrSrSSSSSS.S jrS	 rS
 rS rS r	S r
SS jrS rSS jrS rSrg)r   it  z*
Probability formatter (using Math text).
Fz\frac{1}{2}      )use_overlineone_halfminorminor_thresholdminor_numberc                ^    Xl         X l        X0l        [        5       U l        X@l        XPl        g)a?  
Parameters
----------
use_overline : bool, default: False
    If x > 1/2, with x = 1 - v, indicate if x should be displayed as
    $\overline{v}$. The default is to display $1 - v$.

one_half : str, default: r"\\frac{1}{2}"
    The string used to represent 1/2.

minor : bool, default: False
    Indicate if the formatter is formatting minor ticks or not.
    Basically minor ticks are not labelled, except when only few ticks
    are provided, ticks with most space with neighbor ticks are
    labelled. See other parameters to change the default behavior.

minor_threshold : int, default: 25
    Maximum number of locs for labelling some minor ticks. This
    parameter have no effect if minor is False.

minor_number : int, default: 6
    Number of ticks which are labelled when the number of ticks is
    below the threshold.
N)_use_overline	_one_half_minorr  	_labelled_minor_threshold_minor_number)r,   r  r  r  r  r  s         r.   r/   LogitFormatter.__init__y  s*    B *! /)r1   c                     Xl         g)z
Switch display mode with overline for labelling p>1/2.

Parameters
----------
use_overline : bool
    If x > 1/2, with x = 1 - v, indicate if x should be displayed as
    $\overline{v}$. The default is to display $1 - v$.
Nr  )r,   r  s     r.   r  LogitFormatter.use_overline  s
     *r1   c                     Xl         g)zZ
Set the way one half is displayed.

one_half : str
    The string used to represent 1/2.
N)r  )r,   r  s     r.   set_one_halfLogitFormatter.set_one_half  s	     "r1   c                     Xl         g)z
Set the threshold for labelling minors ticks.

Parameters
----------
minor_threshold : int
    Maximum number of locations for labelling some minor ticks. This
    parameter have no effect if minor is False.
N)r  )r,   r  s     r.   set_minor_threshold"LogitFormatter.set_minor_threshold  s
     !0r1   c                     Xl         g)z
Set the number of minor ticks to label when some minor ticks are
labelled.

Parameters
----------
minor_number : int
    Number of ticks which are labelled when the number of ticks is
    below the threshold.
N)r  )r,   r  s     r.   set_minor_numberLogitFormatter.set_minor_number  s
     *r1   c                   ^^^ [         R                  " T5      U l        U R                  R	                  5         U R
                  (       d  g [        S T 5       5      (       a  g [        T5      U R                  :  Gaa  [        T5      U R                  :  a  U R                  R                  T5        g [         R                  " [         R                  " SU R                  -  S-
  5      * 5      n[         R                  " [         R                  " [         R                  4U45      [         R                  " U[         R                  445      5      m[         R                  " SU45      [         R                  " US45      -   m[!        [#        [        U R                  5      5      UU4S jS9U R                  * S  nU R                  R                  U4S jU 5       5        g g )Nc              3      #    U  Hd  n[        US S9=(       dN    [        SU-
  S S9=(       d:    [        SU-  5      =(       a%    [        [        R                  " SU-  5      5      S:H  v   Mf     g7f)Hz>rtolr(   r#  N)
_is_decader  rz  r.  rG  )r   rh   s     r.   r   *LogitFormatter.set_locs.<locals>.<genexpr>  si      

 	 qt$ +!a%d++ Q' *BHHQUO$)+ s   A,A.r(   rO   c                    > TU    TU    4$ r3   rL   )rp   space_pessimistic	space_sums    r.   <lambda>)LogitFormatter.set_locs.<locals>.<lambda>  s    #4Q#71"Fr1   )keyc              3   .   >#    U  H
  nTU   v   M     g 7fr3   rL   )r   rp   r   s     r.   r   r    s     %Bz!d1gzs   )r.  arrayr   r  clearr  allr   r  r  updatediffr  minimumconcatenateinfr`  range)r,   r   r  
good_minorr  r  s    `  @@r.   rm   LogitFormatter.set_locs  si   HHTN	{{ 

 
 
 
 t9t,,,4y4---%%d+ wwq499}q'8 99:$&JJNNRVVIt#45NND266)#45%!
 NND$<0nndD\23  $#dii.)F %%%&(
 %%%Bz%BB3 -r1   c                     U(       a-  [         R                  " [        R                  " U5      5      nSnOSnSnUSU* -  -  n[	        U5      S:  a  UnO[        R
                  " [        R                  " X!-
  5      5      S   n[        R                  " U5      * U-   n[        U5      (       a  [        [        R                  " U5      5      O[         R                  " U5      nXu:  a  UnSXv4-  n	U(       d  U	$ SX4-  n
U
$ )Nr   r(   rB  r#  z%.*fz%s\cdot10^{%d})rD  rE  r.  rF  r   sortr  r  rz  rG  re  )r,   rh   r   sci_notationrI  min_precisionrq   	precisionr  r  r   s              r.   _format_valueLogitFormatter._format_value  s    zz"((1+.HMHMBH9%%t9q=%I77266$(+,Q/D$(2I $I.. BHHY'(YYy) 
 ()	i//O 44r1   c                 8    U R                   (       a  SU-  $ SU 3$ )Nz\overline{%s}1-r  )r,   r   s     r.   
_one_minusLogitFormatter._one_minus  s!    #a''s8Or1   Nc                    U R                   (       a  XR                  ;  a  gUS::  d  US:  a  g[        SU-  5      (       a#  [        SU-  5      S:X  a  U R                  nSU-  $ US:  a8  [        USS9(       a)  [        [        R                  " U5      5      nSU-  nSU-  $ US:  aM  [        SU-
  SS9(       a;  [        [        R                  " SU-
  5      5      nU R                  SU-  5      nSU-  $ US	:  a   U R                  XR                  5      nSU-  $ US
:  a6  U R                  U R                  SU-
  SU R                  -
  5      5      nSU-  $ U R                  XR                  SS9nSU-  $ )Nr~   r   r(   r#        ?r  r  z10^{%d}皙??F)r  rx  )r  r  r  rG  r  r  rD  rF  r  r  r   )r,   rh   ri   r   rI  s        r.   rj   LogitFormatter.__call__  sn   ;;1NN26Q!VAE""uQU|q'8A %q(( WAD1TZZ]+HH$A %q(( WAE5TZZA./H	H 45A %q(( W""1ii0A
 %q((	 W 2 21Q3$)) DEA %q(( ""1iie"DA$q((r1   c                 <    US:  a  US $ US:  a  US $ SSU-
  S 3$ )Nr  rC  r  rw  r  r(   rL   ru   s     r.   rz    LogitFormatter.format_data_short.  s9     3;AY3;AYAIa=!!r1   )r  r  r  r  r  r  r   )Tr3   )rP   rQ   rR   rS   r   r/   r  r  r  r  rm   r  r  rj   rz   rT   rL   r1   r.   r   r   t  sM     &*P
*"
0*(CT4)*"r1   r   c                      ^  \ rS rSrSr0 SS_SS_SS_S	S
_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS _S!S"_S#S$_S%S&S'S(S).ErS4S*S*S+S,.U 4S- jjjrS5S. jrS/ rS0 r	S1 r
S2 rS3rU =r$ )6r   i8  z
Format axis values using engineering prefixes to represent powers
of 1000, plus a specified unit, e.g., 10 MHz instead of 1e7.
iqiriyizir?  irw  ipirm  i   µmr   r~   rt  kr  MrK   G   T   P   EZYRQ)            NF)r   r   r   c                J   > Xl         X l        X0l        [        TU ]  UUSUS9  g)a  
Parameters
----------
unit : str, default: ""
    Unit symbol to use, suitable for use with single-letter
    representations of powers of 1000. For example, 'Hz' or 'm'.

places : int, default: None
    Precision with which to display the number, specified in
    digits after the decimal point (there will be between one
    and three digits before the decimal point). If it is None,
    the formatting falls back to the floating point format '%g',
    which displays up to 6 *significant* digits, i.e. the equivalent
    value for *places* varies between 0 and 5 (inclusive).

sep : str, default: " "
    Separator used between the value and the prefix/unit. For
    example, one get '3.14 mV' if ``sep`` is " " (default) and
    '3.14mV' if ``sep`` is "". Besides the default behavior, some
    other useful options may be:

    * ``sep=""`` to append directly the prefix/unit to the value;
    * ``sep="\N{THIN SPACE}"`` (``U+2009``);
    * ``sep="\N{NARROW NO-BREAK SPACE}"`` (``U+202F``);
    * ``sep="\N{NO-BREAK SPACE}"`` (``U+00A0``).

usetex : bool, default: :rc:`text.usetex`
    To enable/disable the use of TeX's math mode for rendering the
    numbers in the formatter.

useMathText : bool, default: :rc:`axes.formatter.use_mathtext`
    To enable/disable the use mathtext for rendering the numbers in
    the formatter.
useOffset : bool or float, default: False
    Whether to use offset notation with :math:`10^{3*N}` based prefixes.
    This features allows showing an offset with standard SI order of
    magnitude prefix near the axis. Offset is computed similarly to
    how `ScalarFormatter` computes it internally, but here you are
    guaranteed to get an offset which will make the tick labels exceed
    3 digits. See also `.set_useOffset`.

    .. versionadded:: 3.10
F)r   r   r   r   N)unitplacessepr   r/   )r,   r3  r4  r5  r   r   r   r   s          r.   r/   EngFormatter.__init__W  s3    Z 	#	 	 	
r1   c                 *   [        U R                  5      S:X  d  U R                  S:X  a   U R                  U R	                  U5      5      $ XR                  -
  SU R
                  -  -  n[        U5      S:  a  SnU R                  U R                  U5      $ )z
Return the format for tick value *x* at position *pos*.

If there is no currently offset in the data, it returns the best
engineering formatting that fits the given argument, independently.
r   r  r  )	r   r   r   r   rv   r   r  r  r   r  s       r.   rj   EngFormatter.__call__  s{     tyy>Q$++"2>>$"2"21"566kk/cT-B-B&BCB2w~66t{{BGGr1   c                    Xl         [        U R                   5      S:  a  [        U R                  R	                  5       5      u  p#U R
                  (       a6  U R                  5         U R                  S:w  a  [        X#-   S-  S5      U l        [        R                  " [        R                  " X2-
  S5      5      S-  U l        U R                  5         g g )Nr   r#  rt    )r   r   r`  rY   r6   r   rS  r   rG  rD  rE  r  r   rU  )r,   r   r;   r<   s       r.   rm   EngFormatter.set_locs  s    	tyy>A		 ; ; =>JD$$&;;!# #(a";DK$(JJtxxT/J$KA$MD! r1   c                    [        U R                  5      S:X  a  gU R                  (       a  SnU R                  (       a0  U R                  U R                  5      nU R                  S:  a  SU-   nU R                  SU R                  -  5      nU R
                  (       d  U R                  (       a  US:w  a  SU-  nSU U S3nOX!-   nU R                  U5      $ g)Nr   r~   rL  rB  z\times%srM  )r   r   r   rv   r   r  r   r   rN  s       r.   r   EngFormatter.get_offset  s    tyy>Q;;I{{ ,,T[[9	;;? #iI((t/D/D)DEI  DLL? +i 7I	{9+Q/)>>!$$r1   c                 $    U R                  U5      $ )z!Alias to EngFormatter.format_datary   )r,   nums     r.   
format_engEngFormatter.format_eng  s    $$r1   c                    SnU R                   c  SOSU R                   S S3nUS:  a  SnU* nUS:w  a:  [        [        R                  " [        R                  " U5      S-  5      S-  5      nOSnS	n[
        R                  " U[        U R                  5      [        U R                  5      5      nX!-  S
U-  -  n[        [        [        XS5      5      5      S:  a#  U[        U R                  5      :  a
  US-  nUS-  nU R                  [        U5         nU R                  (       d  U(       a  U R                   U U R                   3nOSnU R                  (       d  U R                   (       a	  SXS  SU 3$ XS  U 3$ )u+  
Format a number in engineering notation, appending a letter
representing the power of 1000 of the original number.
Some examples:

>>> format_data(0)        # for self.places = 0
'0'

>>> format_data(1000000)  # for self.places = 1
'1.0 M'

>>> format_data(-1e-6)  # for self.places = 2
'-1.00 µ'
r(   r-  r  r  rw  r   r+  rt  r  r  r:  r~   rM  )r4  rz  rD  rE  rF  r.  cliprb  ENG_PREFIXESr8  r  rc  r   r3  r5  r   r  )r,   rq   rk  r   pow10mantunit_prefixsuffixs           r.   rv   EngFormatter.format_data  s[    [[(c$++a.B19DFEA:

4::e#4q#89A=>EE Es4#4#45s4;L;L7MN|tu}- fT'()T1C 1 122DLDQJE''E
399z+tyyk:FF<<4,,tEl!F8,,5\&**r1   )r   r   r   r4  r5  r3  )r~   N r3   )rP   rQ   rR   rS   r   rD  r/   rj   rm   r   r@  rv   rT   r   r   s   @r.   r   r   8  s!   SS 	S 	S	
 	S 	S 	S 
S 
 
S R S S S 
S  
S!" 
S#$ +L05
!U5
 5
nH2(%2+ 2+r1   r   c                   l    \ rS rSrSrSS jrSS jrS rS r\	S 5       r
\
R                  S	 5       r
S
rg)r   i  ah  
Format numbers as a percentage.

Parameters
----------
xmax : float
    Determines how the number is converted into a percentage.
    *xmax* is the data value that corresponds to 100%.
    Percentages are computed as ``x / xmax * 100``. So if the data is
    already scaled to be percentages, *xmax* will be 100. Another common
    situation is where *xmax* is 1.0.

decimals : None or int
    The number of decimal places to place after the point.
    If *None* (the default), the number will be computed automatically.

symbol : str or None
    A string that will be appended to the label. It may be
    *None* or empty to indicate that no symbol should be used. LaTeX
    special characters are escaped in *symbol* whenever latex mode is
    enabled, unless *is_latex* is *True*.

is_latex : bool
    If *False*, reserved LaTeX characters in *symbol* will be escaped.
Nc                 <    US-   U l         X l        X0l        X@l        g )Nr  )xmaxrv  _symbol	_is_latex)r,   rM  rv  symbolis_latexs        r.   r/   PercentFormatter.__init__  s    3J	 !r1   c                     U R                   R                  5       u  p4[        XC-
  5      nU R                  U R	                  X5      5      $ )z=Format the tick as a percentage with the appropriate scaling.)rY   r6   r  r   
format_pct)r,   rh   ri   ax_minax_maxdisplay_ranges         r.   rj   PercentFormatter.__call__#  s:    446FO,~~dooa?@@r1   c                 L   U R                  U5      nU R                  c\  U R                  U5      nUS::  a  SnON[        R                  " S[        R                  " SU-  5      -
  5      nUS:  a  SnOUS:  a  SnOU R                  nUS[        U5       S3 nXPR                  -   $ )a  
Format the number as a percentage number with the correct
number of decimals and adds the percent symbol, if any.

If ``self.decimals`` is `None`, the number of digits after the
decimal point is set based on the *display_range* of the axis
as follows:

============= ======== =======================
display_range decimals sample
============= ======== =======================
>50           0        ``x = 34.5`` => 35%
>5            1        ``x = 34.5`` => 34.5%
>0.5          2        ``x = 34.5`` => 34.50%
...           ...      ...
============= ======== =======================

This method will not be very good for tiny axis ranges or
extremely large ones. It assumes that the values on the chart
are percentages displayed on a reasonable scale.
r          @   z0.rw  )convert_to_pctrv  rD  re  rF  rz  rP  )r,   rh   rW  scaled_rangerv  r   s         r.   rT  PercentFormatter.format_pct)  s    , "== ..}=Lq   99S4::cL6H+I%IJa< H\ H}}HCM?!#$;;r1   c                 $    SXR                   -  -  $ )Ng      Y@)rM  )r,   rh   s     r.   r\  PercentFormatter.convert_to_pctU  s    II&&r1   c                     U R                   nU(       d  SnU$ U R                  (       d6  [        R                  S   (       a  S H  nUR	                  USU-   5      nM     U$ )z
The configured percent symbol as a string.

If LaTeX is enabled via :rc:`text.usetex`, the special characters
``{'#', '$', '%', '&', '~', '_', '^', '\', '{', '}'}`` are
automatically escaped in the string.
r~   r   z
\#$%&~_^{}\)rN  rO  r   r   r   )r,   rP  specs      r.   rP  PercentFormatter.symbolX  sU     F  CLL$? &dTk: &r1   c                     Xl         g r3   )rN  )r,   rP  s     r.   rP  rd  l  s    r1   )rO  rN  rv  rM  )d   N%Fr3   )rP   rQ   rR   rS   r   r/   rj   rT  r\  r  rP  setterrT   rL   r1   r.   r   r     sI    2"A*X'  & ]] r1   r   c                   @    \ rS rSrSrSrS rS rS rS r	S r
S	 rS
rg)r   iq  z
Determine tick locations.

Note that the same locator should not be used across multiple
`~matplotlib.axis.Axis` because the locator stores references to the Axis
data and view limits.
r:  c                     [        S5      e)aK  
Return the values of the located ticks given **vmin** and **vmax**.

.. note::
    To get tick locations with the vmin and vmax values defined
    automatically for the associated ``axis`` simply call
    the Locator instance::

        >>> print(type(loc))
        <type 'Locator'>
        >>> print(loc())
        [1, 2, 3, 4]

rd   re   r:   s      r.   tick_valuesLocator.tick_values  s     ""9::r1   c                 Z    [         R                  " S[        [        U 5      5      -   5        g)zm
Do nothing, and raise a warning. Any locator class not supporting the
set_params() function will call this.
z/'set_params()' not defined for locator of type N)r   r  r  typer]   s     r.   
set_paramsLocator.set_params  s%    
 	=T
O	r1   c                     [        S5      e)"Return the locations of the ticks.rd   re   r5   s    r.   rj   Locator.__call__  s     ""9::r1   c                     [        U5      U R                  :  a2  [        R                  S[        U5      US   US   U R                  5        U$ )at  
Log at WARNING level if *locs* is longer than `Locator.MAXTICKS`.

This is intended to be called immediately before returning *locs* from
``__call__`` to inform users in case their Locator returns a huge
number of ticks, causing Matplotlib to run out of memory.

The "strange" name of this method dates back to when it would raise an
exception instead of emitting a log.
z]Locator attempting to generate %s ticks ([%s, ..., %s]), which exceeds Locator.MAXTICKS (%s).r   r+  )r   MAXTICKS_logwarningr   s     r.   raise_if_exceedsLocator.raise_if_exceeds  sE     t9%LL7D	47DHdmm= r1   c                 ,    [         R                  " XSS9$ )a  
Adjust a range as needed to avoid singularities.

This method gets called during autoscaling, with ``(v0, v1)`` set to
the data limits on the Axes if the Axes contains any data, or
``(-inf, +inf)`` if not.

- If ``v0 == v1`` (possibly up to some floating point slop), this
  method returns an expanded interval around this value.
- If ``(v0, v1) == (-inf, +inf)``, this method returns appropriate
  default view limits.
- Otherwise, ``(v0, v1)`` is returned without modification.
r  r  r  r  )r,   v0v1s      r.   r  Locator.nonsingular  s     &&r<<r1   c                 .    [         R                  " X5      $ )zv
Select a scale for the range from vmin to vmax.

Subclasses should override this method to change locator behaviour.
r{  r:   s      r.   view_limitsLocator.view_limits  s     &&t22r1   rL   N)rP   rQ   rR   rS   r   ru  rk  ro  rj   rx  r  r  rT   rL   r1   r.   r   r   q  s,     H;";$= 3r1   r   c                   4    \ rS rSrSrS rS	S jrS rS rSr	g)
r   i  z
Place ticks at every nth point plotted.

IndexLocator assumes index plotting; i.e., that the ticks are placed at integer
values in the range between 0 and len(data) inclusive.
c                     Xl         X l        g)z:Place ticks every *base* data point, starting at *offset*.Nr  r   r,   r  r   s      r.   r/   IndexLocator.__init__  s    
r1   Nc                 *    Ub  Xl         Ub  X l        gg)z"Set parameters within this locatorNr  r  s      r.   ro  IndexLocator.set_params  s    J K r1   c                 \    U R                   R                  5       u  pU R                  X5      $ )z!Return the locations of the ticks)rY   rE   rk  r,   dmindmaxs      r.   rj   IndexLocator.__call__  '    YY002
++r1   c                     U R                  [        R                  " XR                  -   US-   U R                  5      5      $ )Nr(   )rx  r.  r  r   r  r:   s      r.   rk  IndexLocator.tick_values  s6    $$IId[[($(DJJ?A 	Ar1   r  NN
rP   rQ   rR   rS   r   r/   ro  rj   rk  rT   rL   r1   r.   r   r     s    
!,
Ar1   r   c                   8    \ rS rSrSrS	S jrS	S jrS rS rSr	g)
r   i  a  
Place ticks at a set of fixed values.

If *nbins* is None ticks are placed at all values. Otherwise, the *locs* array of
possible positions will be subsampled to keep the number of ticks
:math:`\leq nbins + 1`. The subsampling will be done to include the smallest
absolute value; for example, if zero is included in the array of possibilities, then
it will be included in the chosen ticks.
Nc                     [         R                  " U5      U l        [        R                  " SU R                  S9  Ub  [        US5      U l        g S U l        g )Nr3   r   r#  )r.  ra  r   r   check_shaper8  nbins)r,   r   r  s      r.   r/   FixedLocator.__init__  s>    JJt$	tyy1&+&7S]
T
r1   c                     Ub  Xl         gg#Set parameters within this locator.Nr  )r,   r  s     r.   ro  FixedLocator.set_params  s    J r1   c                 &    U R                  S S 5      $ r3   rk  r5   s    r.   rj   FixedLocator.__call__      d++r1   c           	         U R                   c  U R                  $ [        [        [        R
                  " [        U R                  5      U R                   -  5      5      S5      nU R                  SSU2   n[        SU5       Hc  nU R                  USU2   n[        R                  " U5      R                  5       [        R                  " U5      R                  5       :  d  Ma  UnMe     U R                  U5      $ )z
Return the locations of the ticks.

.. note::

    Because the values are fixed, vmin and vmax are not used in this
    method.

Nr(   )r  r   r8  rz  r.  re  r   r  r  rb  rx  )r,   r;   r<   stepticksrp   ticks1s          r.   rk  FixedLocator.tick_values   s     ::993rwws499~

:;<a@		&D&!q$AYYqw$w'Fvvf~!!#bffUm&7&7&99   $$U++r1   )r   r  r3   r  rL   r1   r.   r   r     s    B

,,r1   r   c                   $    \ rS rSrSrS rS rSrg)r   i  z

No ticks
c                 &    U R                  S S 5      $ r3   r  r5   s    r.   rj   NullLocator.__call__  r  r1   c                     / $ )z
Return the locations of the ticks.

.. note::

    Because the values are Null, vmin and vmax are not used in this
    method.
rL   r:   s      r.   rk  NullLocator.tick_values  s	     	r1   rL   N)rP   rQ   rR   rS   r   rj   rk  rT   rL   r1   r.   r   r     s    ,	r1   r   c                   r    \ rS rSrSrSS jr\S 5       r\R                  S 5       rSS jr	S r
S	 rS
 rSrg)r   i)  z
Place ticks at evenly spaced values.

The first time this function is called it will try to set the
number of ticks to make a nice tick partitioning.  Thereafter, the
number of ticks will be fixed so that interactive navigation will
be nice

Nc                 2    Xl         Uc  0 U l        gX l        g)a'  
Parameters
----------
numticks : int or None, default None
    Number of ticks. If None, *numticks* = 11.
presets : dict or None, default: None
    Dictionary mapping ``(vmin, vmax)`` to an array of locations.
    Overrides *numticks* if there is an entry for the current
    ``(vmin, vmax)``.
N)numtickspresetsr,   r  r  s      r.   r/   LinearLocator.__init__3  s     !?DL"Lr1   c                 8    U R                   b  U R                   $ S$ )N   	_numticksr5   s    r.   r  LinearLocator.numticksD  s     "&!;t~~CCr1   c                     Xl         g r3   r  )r,   r  s     r.   r  r  I  s    !r1   c                 *    Ub  X l         Ub  Xl        ggr  )r  r  r  s      r.   ro  LinearLocator.set_paramsM  s    "L$M  r1   c                 \    U R                   R                  5       u  pU R                  X5      $ rr  rY   r6   rk  r:   s      r.   rj   LinearLocator.__call__T  r  r1   c                     [         R                  " XSS9u  pX4U R                  ;   a  U R                  X4   $ U R                  S:X  a  / $ [        R
                  " XU R                  5      nU R                  U5      $ )Nr  r  r   )r  r  r  r  r.  linspacerx  )r,   r;   r<   ticklocss       r.   rk  LinearLocator.tick_valuesY  sk     ,,T$G
<4<<'<<--==AI;;t4==9$$X..r1   c           	         X!:  a  X!p!X:X  a
  US-  nUS-  n[         R                  S   S:X  a  [        [        R                  " X!-
  5      [        R                  " [        U R                  S-
  S5      5      5      u  p4X4S:  -  n[        U R                  S-
  S5      U* -  n[        R                  " XQ-  5      U-  n[        R                  " XR-  5      U-  n[        R                  " X5      $ ),Try to choose the view limits intelligently.r(   axes.autolimit_moderound_numbersr  )r   r   divmodrD  rF  r8  r  rE  re  r  r  )r,   r;   r<   rI  	remainderscales         r.   r  LinearLocator.view_limitse  s     ;$<AIDAID<<-./A"(

4;'C8I14M)N#PHR(H)1-8)<E::el+e3D99U\*U2D&&t22r1   )r  r  r  r  )rP   rQ   rR   rS   r   r/   r  r  rh  ro  rj   rk  r  rT   rL   r1   r.   r   r   )  sN    #" D D __" "%,

/3r1   r   c                   >    \ rS rSrSrS
S jrSS jrS rS rS r	S	r
g)r   iz  zA
Place ticks at every integer multiple of a base plus an offset.
c                 2    [        US5      U l        X l        g)z
Parameters
----------
base : float > 0, default: 1.0
    Interval between ticks.
offset : float, default: 0.0
    Value added to each multiple of *base*.

    .. versionadded:: 3.8
r   N_Edge_integer_edge_offsetr  s      r.   r/   MultipleLocator.__init__  s     #4+
r1   Nc                 @    Ub  [        US5      U l        Ub  X l        gg)z
Set parameters within this locator.

Parameters
----------
base : float > 0, optional
    Interval between ticks.
offset : float, optional
    Value added to each multiple of *base*.

    .. versionadded:: 3.8
Nr   r  r  s      r.   ro  MultipleLocator.set_params  s(     &tQ/DJ!L r1   c                 \    U R                   R                  5       u  pU R                  X5      $ r  r  r:   s      r.   rj   MultipleLocator.__call__  r  r1   c                 H   X!:  a  X!p!U R                   R                  nXR                  -  nX R                  -  nU R                   R                  U5      U-  nX!-
  SU-  -   U-  nX-
  [        R
                  " US-   5      U-  -   U R                  -   nU R                  U5      $ )Nru  rt  )r  r  r  ger.  r  rx  )r,   r;   r<   r  rm  r   s         r.   rk  MultipleLocator.tick_values  s    ;$zzzz}}T"T)[54<'D0{RYYq1u-44t||C$$T**r1   c                    [         R                  S   S:X  a  U R                  R                  XR                  -
  5      U R                  R
                  -  U R                  -   nU R                  R                  X R                  -
  5      U R                  R
                  -  U R                  -   nX4:X  a
  US-  nUS-  nOUnUn[        R                  " X45      $ )zG
Set the view limits to the nearest tick values that contain the data.
r  r  r(   )	r   r   r  ler  r  r  r  r  )r,   r  r  r;   r<   s        r.   r  MultipleLocator.view_limits  s     <<-./A::==!45

G$,,VD::==!45

G$,,VD|		DD&&t22r1   )r  r  )      ?r  r  rP   rQ   rR   rS   r   r/   ro  rj   rk  r  rT   rL   r1   r.   r   r   z  s     "$,
	+3r1   r   c                 
   [        X-
  5      nX-   S-  n[        U5      U-  U:  a  SnO:[        R                  " S[        R                  " [        U5      5      S-  -  U5      nS[        R                  " XB-  5      S-  -  nXv4$ )Nr#  r   rB  r(   )r  rD  rd  rF  )r;   r<   rm  	thresholddvmeanvr   r  s           r.   scale_ranger    sx    	T[	B[AE
5zB"rdjjU&<&ABEJ4::bf%*+E=r1   c                   0    \ rS rSrSrS rS rS rS rSr	g)	r  i  z
Helper for `.MaxNLocator`, `.MultipleLocator`, etc.

Take floating-point precision limitations into account when calculating
tick locations as integer multiples of a step.
c                 R    US::  a  [        S5      eXl        [        U5      U l        g)z
Parameters
----------
step : float > 0
    Interval between ticks.
offset : float
    Offset subtracted from the data limits prior to calculating tick
    locations.
r   z'step' must be positiveN)r  r  r  r  )r,   r  r   s      r.   r/   _Edge_integer.__init__  s'     19677	6{r1   c                     U R                   S:  aL  [        R                  " U R                   U R                  -  5      n[	        SSUS-
  -  5      n[        SU5      nOSn[        X-
  5      U:  $ )Nr   g|=rB  r$  g<Nё\?)r  r.  rF  r  r8  rb  r  )r,   msedgedigitstols        r.   closeto_Edge_integer.closeto  s`    <<!XXdllTYY67FeRFRK01Cfc"CC29~##r1   c                     [        XR                  5      u  p#U R                  X0R                  -  S5      (       a  US-   $ U$ )z"Return the largest n: n*step <= x.r(   r  r  r  r,   rh   r  r   s       r.   r  _Edge_integer.le  s7    a#<<IIq))q5Lr1   c                     [        XR                  5      u  p#U R                  X0R                  -  S5      (       a  U$ US-   $ )z#Return the smallest n: n*step >= x.r   r(   r  r  s       r.   r  _Edge_integer.ge  s7    a#<<IIq))H1ur1   )r  r  N)
rP   rQ   rR   rS   r   r/   r  r  r  rT   rL   r1   r.   r  r    s    #$r1   r  c            	       v    \ rS rSrSr\" SSSSSSS9rSS jr\S	 5       r	\S
 5       r
S rS rS rS rS rSrg)r   i  z
Place evenly spaced ticks, with a cap on the total number of ticks.

Finds nice tick locations with no more than :math:`nbins + 1` ticks being within the
view limits. Locations beyond the limits are added to support autoscaling.
rB  NFr#  )r  stepsinteger	symmetricprunemin_n_ticksc                 R    Ub  XS'   U R                   " S0 0 U R                  EUED6  g)a  
Parameters
----------
nbins : int or 'auto', default: 10
    Maximum number of intervals; one less than max number of
    ticks.  If the string 'auto', the number of bins will be
    automatically determined based on the length of the axis.

steps : array-like, optional
    Sequence of acceptable tick multiples, starting with 1 and
    ending with 10. For example, if ``steps=[1, 2, 4, 5, 10]``,
    ``20, 40, 60`` or ``0.4, 0.6, 0.8`` would be possible
    sets of ticks because they are multiples of 2.
    ``30, 60, 90`` would not be generated because 3 does not
    appear in this example list of steps.

integer : bool, default: False
    If True, ticks will take only integer values, provided at least
    *min_n_ticks* integers are found within the view limits.

symmetric : bool, default: False
    If True, autoscaling will result in a range symmetric about zero.

prune : {'lower', 'upper', 'both', None}, default: None
    Remove the 'lower' tick, the 'upper' tick, or ticks on 'both' sides
    *if they fall exactly on an axis' edge* (this typically occurs when
    :rc:`axes.autolimit_mode` is 'round_numbers').  Removing such ticks
    is mostly useful for stacked or ganged plots, where the upper tick
    of an Axes overlaps with the lower tick of the axes above it.

min_n_ticks : int, default: 2
    Relax *nbins* and *integer* constraints if necessary to obtain
    this minimum number of ticks.
Nr  rL   )ro  default_params)r,   r  r^   s      r.   r/   MaxNLocator.__init__  s2    F #7O<;T00;F;<r1   c                    [         R                  " U 5      (       d  [        S5      e[         R                  " U 5      n [         R                  " [         R
                  " U 5      S:*  5      (       d  U S   S:  d	  U S   S:  a  [        S5      eU S   S:w  a  [         R                  " S/U /5      n U S   S:w  a  [         R                  " U S//5      n U $ )NzSsteps argument must be an increasing sequence of numbers between 1 and 10 inclusiver   r+  rB  r(   )r.  iterabler  ra  anyr  r  r  s    r.   _validate_stepsMaxNLocator._validate_steps/  s    {{5!! E F F

5!66"''%.A%&&%)b.E!HqL E F F8q=NNQC<0E9?NNEB4=1Er1   c                 N    [         R                  " SU S S -  U SU S   -  //5      $ )Nr  r+  rB  r(   )r.  r  r  s    r.   
_staircaseMaxNLocator._staircase>  s/     ~~sU3BZ/eAhHIIr1   c                    SU;   a@  UR                  S5      U l        U R                  S:w  a  [        U R                  5      U l        SU;   a  UR                  S5      U l        SU;   a.  UR                  S5      n[        R
                  " / SQUS9  X l        SU;   a   [        SUR                  S5      5      U l        S	U;   ah  UR                  S	5      nUc  [        R                  " / SQ5      U l        OU R                  U5      U l        U R                  U R                  5      U l        SU;   a  UR                  S5      U l        U(       a  [        R                   " SU5      eg
)a  
Set parameters for this locator.

Parameters
----------
nbins : int or 'auto', optional
    see `.MaxNLocator`
steps : array-like, optional
    see `.MaxNLocator`
integer : bool, optional
    see `.MaxNLocator`
symmetric : bool, optional
    see `.MaxNLocator`
prune : {'lower', 'upper', 'both', None}, optional
    see `.MaxNLocator`
min_n_ticks : int, optional
    see `.MaxNLocator`
r  autor  r  )upperlowerbothN)r  r  r(   r  N)
r(   g      ?r#        @rt     r[  r     rB  r  ro  )pop_nbinsrz  
_symmetricr   check_in_list_pruner8  _min_n_ticksr.  r  _stepsr  r  _extended_steps_integerkwarg_error)r,   r^   r  r  s       r.   ro  MaxNLocator.set_paramsD  s"   & f **W-DK{{f$!$++.& $jj5DOfJJw'E?uMKF" #Avzz-'@ ADfJJw'E} hh'JK"2259#'??4;;#?D "JJy1DM""<88 r1   c                 8   U R                   S:X  aX  U R                  bH  [        R                  " U R                  R	                  5       [        SU R                  S-
  5      S5      nOSnOU R                   n[        XU5      u  pEX-
  nX%-
  nU R                  U-  nU R                  (       a:  US:  [        R                  " U[        R                  " U5      -
  5      S:  -  n	X   nXv-
  U-  n
[        U R                  S5      (       a,  U R                  R                  R                  S:X  a  U
S-  S	-  n
X:  n[        R                   S
   S:X  a  Xh-  U-  nXU-  -   nXU:  -  n[#        U5      (       a  [        R$                  " U5      S   S   nO['        U5      S-
  nUSUS-    SSS2    H  nU R                  (       aJ  [        R(                  " U5      [        R*                  " U5      -
  U R                  S-
  :  a  [        SU5      nXo-  U-  n[-        X5      nUR/                  UU-
  5      nUR1                  UU-
  5      n[        R2                  " UUS-   5      U-  U-   nUU:*  UU:  -  R5                  5       nUU R                  :  d  M    UU-   $    WU-   $ )z
Generate a list of tick locations including the range *vmin* to
*vmax*.  In some applications, one or both of the end locations
will not be needed, in which case they are trimmed off
elsewhere.
r  Nr(   rK   ru  r3  3d   r/  r  r  r   r+  )r  rY   r.  rC  rM   r8  r  r  r  r  r  rG  hasattrr3  namer   r   r  nonzeror   rE  re  r  r  r  r  sum)r,   r;   r<   r  r  r   _vmin_vmaxr  igoodraw_steplarge_stepsfloored_vminsfloored_vmaxsistepr  	best_vminr  lowhighr  ntickss                         r.   
_raw_ticksMaxNLocator._raw_tickso  sn    ;;& yy$		 8 8 : #At'8'81'< =qB KKE#D6$$u,==QY266%"((5/*A#BU#JKELE]e+499f%%$))..*=*=*E  "}R'H'<<-./A #^u4M)EM9M%%)?@K {JJ{+A.q1EJNE
 (57ODbD)DHHUObggen48I8IA8MM1d|$.I !.D''%)+,C7759,-DIIc4!8,t3i?E~%5.9>>@F***v~' *& v~r1   c                 \    U R                   R                  5       u  pU R                  X5      $ r3   r  r:   s      r.   rj   MaxNLocator.__call__  s'    YY002
++r1   c                 8   U R                   (       a!  [        [        U5      [        U5      5      nU* n[        R                  " XSSS9u  pU R                  X5      nU R                  nUS:X  a  USS  nOUS:X  a  US S nOUS:X  a  USS nU R                  U5      $ )	NvIh%<=g+=r  tinyr  r(   r  r+  r  )r  r8  r  r  r  r)  r  rx  )r,   r;   r<   r   r  s        r.   rk  MaxNLocator.tick_values  s    ??s4y#d),D5D ,,U4
t*G8Dg9Df_":D$$T**r1   c                     U R                   (       a!  [        [        U5      [        U5      5      nU* n[        R                  " XSSS9u  p[
        R                  S   S:X  a  U R                  X5      SS/   $ X4$ )Ng-q=r.  r/  r  r  r   r+  )r  r8  r  r  r  r   r   r)  r  s      r.   r  MaxNLocator.view_limits  sq    ??s4y#d),D5D ,,U4
 <<-./A??4.2w77:r1   )r  r  r  r  r  r  r  r3   )rP   rQ   rR   rS   r   dictr  r/   r   r  r  ro  r)  rj   rk  r  rT   rL   r1   r.   r   r     sp      $"'$) $&')N%=N   J J
)9VCJ,+"r1   r   rB  )r  r  c                d   [         R                  " U 5      (       d  gU S:X  a  g[         R                  " [        U 5      5      [         R                  " U5      -  nUc+  [         R                  " U[         R
                  " U5      5      $ [         R                  " U[         R
                  " U5      US9$ )z1Return True if *x* is an integer power of *base*.Fr  Tr  )r.  isfiniter  r  iscloserG  )rh   r  r  lxs       r.   r  r    ss    ;;q>>Cx	A"&&,	&B|zz"bhhrl++zz"bhhrl66r1   c                     U S:X  a  U $ U S:  a  [        U * U5      * $ U[        R                  " [        R                  " U 5      [        R                  " U5      -  5      -  $ )z~
Return the largest integer power of *base* that's less or equal to *x*.

If *x* is negative, the exponent will be *greater*.
r   )_decade_greater_equalr.  rE  r  rh   r  s     r.   _decade_less_equalr<    sX     aA 801A"A2t,,8BHHRVVAY5668r1   c                     U S:X  a  U $ U S:  a  [        U * U5      * $ U[        R                  " [        R                  " U 5      [        R                  " U5      -  5      -  $ )z
Return the smallest integer power of *base* that's greater or equal to *x*.

If *x* is negative, the exponent will be *smaller*.
r   )r<  r.  re  r  r;  s     r.   r:  r:    sX     aA 7-.UD))7BGGBFF1It4557r1   c                 V    U S:  a  [        U * U5      * $ [        X5      nX :X  a  X!-  nU$ )zw
Return the largest integer power of *base* that's less than *x*.

If *x* is negative, the exponent will be *greater*.
r   )_decade_greaterr<  )rh   r  lesss      r.   _decade_lessrA    s8     	1uD)))a&DyKr1   c                 V    U S:  a  [        U * U5      * $ [        X5      nX :X  a  X!-  nU$ )z{
Return the smallest integer power of *base* that's greater than *x*.

If *x* is negative, the exponent will be *smaller*.
r   )rA  r:  )rh   r  greaters      r.   r?  r?  	  s8     	1uaR&&&#A,G|Nr1   c                 B    [         R                  " U [        U 5      5      $ r3   )rD  r7  rG  rh   s    r.   r  r  	  s    <<58$$r1   c                   Z    \ rS rSrSrSSS.S jjrSSS.S jjrS rS rS	 r	S
 r
S rSrg)r   i	  zX
Place logarithmically spaced ticks.

Places ticks at the values ``subs[j] * base**i``.
N)r  c                    Uc  [         R                  S   (       a  SnOSn[        U5      U l        U R	                  U5        X0l        g)a  
Parameters
----------
base : float, default: 10.0
    The base of the log used, so major ticks are placed at ``base**n``, where
    ``n`` is an integer.
subs : None or {'auto', 'all'} or sequence of float, default: (1.0,)
    Gives the multiples of integer powers of the base at which to place ticks.
    The default of ``(1.0, )`` places ticks only at integer powers of the base.
    Permitted string values are ``'auto'`` and ``'all'``. Both of these use an
    algorithm based on the axis view limits to determine whether and how to put
    ticks between integer powers of the base:
    - ``'auto'``: Ticks are placed only between integer powers.
    - ``'all'``: Ticks are placed between *and* at integer powers.
    - ``None``: Equivalent to ``'auto'``.
numticks : None or int, default: None
    The maximum number of ticks to allow on a given axis. The default of
    ``None`` will try to choose intelligently as long as this Locator has
    already been assigned to an axis using `~.axis.Axis.get_tick_space`, but
    otherwise falls back to 9.
Nr  r&  r  )r   r   rc  r  	_set_subsr  r,   r  subsr  s       r.   r/   LogLocator.__init__!	  s=    , ||45!4[
t r1   c                f    Ub  [        U5      U l        Ub  U R                  U5        Ub  X0l        ggr  )rc  r  rH  r  rI  s       r.   ro  LogLocator.set_params@	  s5    tDJNN4 $M  r1   c                 x   Uc  SU l         g[        U[        5      (       a  [        R                  " SUS9  Xl         g [
        R                  " U[        S9U l         U R                   R                  S:w  a#  [        S	U R                   R                   S
35      eg! [         a  n[        SU S35      UeSnAff = f)zD
Set the minor ticks for the log scaling every ``base**i*subs[j]``.
Nr  )r  r  )rJ  )dtypez>subs must be None, 'all', 'auto' or a sequence of floats, not r  r(   z5A sequence passed to subs must be 1-dimensional, not z-dimensional.)
_subsr1  r  r   r  r.  ra  rc  r  ndim)r,   rJ  rC  s      r.   rH  LogLocator._set_subsI	  s     <DJc""T:J4ZZE:

 zz!#  "7$(JJOO#4M"C D D $	  4  ">$(6", -2344s   B 
B9$B44B9c                 \    U R                   R                  5       u  pU R                  X5      $ r  r  r:   s      r.   rj   LogLocator.__call__^	  r  r1   c                 F   U R                   S:X  aA  U R                  b1  [        R                  " U R                  R	                  5       SS5      nOSnOU R                   nU R
                  nUS::  aS  U R                  b  U R                  R                  5       nUS::  d  [        R                  " U5      (       d  [        S5      e[        R                  SX5        X!:  a  X!p![        R                  " U5      [        R                  " U5      -  n[        R                  " U5      [        R                  " U5      -  n[        R                  " U5      [        R                  " U5      -
  n[        U R                   ["        5      (       au  US:  d  US:  a>  U R                   S:X  a  [        R$                  " / 5      $ [        R$                  " S	/5      nO7U R                   S:X  a  S
OS	n	[        R&                  " X5      nOU R                   n[(        R*                  S   (       a%  [-        [        R                  " XsS-
  -  5      S5      OXs-  S-   n
X:  a  [-        SUS-
  5      n
[/        U5      S:  =(       d    [/        U5      S:H  =(       a    US   S	:g  n[        R&                  " [        R                  " U5      U
-
  [        R                  " U5      SU
-  -   U
5      nU(       aI  U
S:X  a,  [        R0                  " XL-   Vs/ s H  oU-  PM	     sn5      nO[        R$                  " / 5      nOXL-  n[        R                  SU5        [/        U5      S:  a:  U
S:X  a4  X:*  X:*  -  R3                  5       S::  a  [5        5       R7                  X5      $ U R9                  U5      $ s  snf )Nr  r#  rK   r  @Data has no positive values, and therefore cannot be log-scaled.zvmin %s vmax %srB  rt  r  rZ  r  r(   r   zticklocs %r)r  rY   r.  rC  rM   r  rA   r6  r  rv  debugrD  r  rE  re  r1  rP  r  r  r  r   r   r8  r   r  r  r   rk  rx  )r,   r;   r<   r  r  log_vminlog_vmaxr  rJ  _firststride	have_subsdecadesdecade_startr  s                  r.   rk  LogLocator.tick_valuesc	  s   ==F"yy$77499#;#;#=q!D}}HJJ3;yy$yy++-s{"++d"3"3 VX X 	

$d1;$88D>DHHQK/88D>DHHQK/H%		((;;djj#&&{a!e::'88B<'88SE?D $

f 4#yy+::D \\":; diiQ, 78!<$q( 	 FQJ'F IMHc$i1n&GaC	))DJJx069 IIh/!f*<fF {>>=>\J\\L(\JL 88B<|H

=(+IMaK&8+;<AACqH =,,T88((22 Ks   =Nc                     U R                   nU R                  X5      u  p[        R                  S   S:X  a  [	        X5      n[        X#5      nX4$ r  r  r  )r  r  r   r   r<  r:  r,   r;   r<   r  s       r.   r  LogLocator.view_limits	  sK    JJ%%d1
<<-./A%d.D(1Dzr1   c                    X:  a  X!p![         R                  " U5      (       a  [         R                  " U5      (       d  Su  pX4$ US::  a  [        R                  " S5        Su  pX4$ [	        S U R
                  R                  5        5       5      n[         R                  " U5      (       d  SnUS::  a  UnX:X  a*  [        XR                  5      n[        X R                  5      nX4$ )N)r(   rB  r   rV  c              3   @   #    U  H  oR                  5       v   M     g 7fr3   )rA   )r   rY   s     r.   r   )LogLocator.nonsingular.<locals>.<genexpr>	  s     T7St**7Ss   gYn)
r.  r6  r   r  rb  rY   _get_shared_axisrA  r  r?  )r,   r;   r<   r-   s       r.   r  LogLocator.nonsingular	  s    ;${{4  D(9(9JD  z QY JD z Ttyy7Q7Q7STTF;;v&&qy|#D**5&tZZ8zr1   )r  rP  r  )r  )r  r  )rP   rQ   rR   rS   r   r/   ro  rH  rj   rk  r  r  rT   rL   r1   r.   r   r   	  s;    !4 !>%4 %D*,
L3\
r1   r   c                   >    \ rS rSrSrS
S jrSS jrS rS rS r	S	r
g)r    i	  zV
Place ticks spaced linearly near zero and spaced logarithmically beyond a threshold.
Nc                     Ub#  UR                   U l        UR                  U l        OUb  Ub  X@l        X0l        O[	        S5      eUc	  S/U l        OX l        SU l        g)aq  
Parameters
----------
transform : `~.scale.SymmetricalLogTransform`, optional
    If set, defines the *base* and *linthresh* of the symlog transform.
base, linthresh : float, optional
    The *base* and *linthresh* of the symlog transform, as documented
    for `.SymmetricalLogScale`.  These parameters are only used if
    *transform* is not set.
subs : sequence of float, default: [1]
    The multiples of integer powers of the base where ticks are placed,
    i.e., ticks are placed at
    ``[sub * base**i for i in ... for sub in subs]``.

Notes
-----
Either *transform*, or both *base* and *linthresh*, must be given.
Nz?Either transform, or both linthresh and base, must be provided.r  r&  )r  r  r  r  r  rP  r  )r,   r6  rJ  r  r  s        r.   r/   SymmetricalLogLocator.__init__	  sc    &  "DJ'11DO"t'7J'O ; < <<DJJr1   c                 *    Ub  X l         Ub  Xl        ggr  )r  rP  )r,   rJ  r  s      r.   ro   SymmetricalLogLocator.set_params	  s    $MJ r1   c                 \    U R                   R                  5       u  pU R                  X5      $ r  r  r:   s      r.   rj   SymmetricalLogLocator.__call__
  s)     YY002
++r1   c           	      <  ^ U R                   nX!:  a  X!p!U* Us=::  a  Us=:  a  U::  a  O  O[        USU15      $ X* :  nX#:  nU=(       a    X#* :  =(       d    U=(       a    X:  nU R                  mU4S jnSu  pU(       a-  [        U* U5      n
U" [	        U
5      [	        U5      S-   5      u  pSu  pU(       a  [        X15      nU" XS-   5      u  pX-
  X-
  -   nU(       a  US-  n[        XR                  S-
  -  S5      n/ nU(       a2  UR                  ST[        R                  " XU5      S S S2   -  -  5        U(       a  UR                  S5        U(       a)  UR                  T[        R                  " XU5      -  5        [        R                  " U R                  5      n[        U5      S:  d	  US   S:w  a9  / nU H0  nUS:X  a  UR                  U5        M  UR                  UU-  5        M2     OUnU R                  [        R                  " U5      5      $ )Nr   c                   > [         R                  " [         R                  " U 5      [         R                  " T5      -  5      n [         R                  " [         R                  " U5      [         R                  " T5      -  5      nX4$ r3   )r.  rE  r  re  )lohir  s     r.   get_log_range8SymmetricalLogLocator.tick_values.<locals>.get_log_range/
  sP    "&&*rvvd|34BbffTl23B6Mr1   r  r(   r+  r  r  )r  r`  r  rb  r  r8  r  extendr.  r  appendra  rP  r   rx  r  )r,   r;   r<   r  has_ahas_chas_brt  a_loa_hia_upper_limc_loc_hic_lower_limtotal_ticksr[  r]  rJ  r  decader  s                       @r.   rk  !SymmetricalLogLocator.tick_values
  s   OO	;$* :11	14D/** 
"! ,4*,M%2LD<Lzz	 
yj$/K&s;'7TQGJD
i.K&{1H=JD {t{31K[]]Q%67;NN2"))D4:+<<@bD+B "C D E NN3NN4BIId&$ABCzz$**%t9q=DGsNH!Q;OOF+OOD6M2	 " H$$RXXh%788r1   c                     U R                   nX!:  a  X!p![        R                  S   S:X  a1  [        X5      n[	        X#5      nX:X  a  [        X5      n[        X#5      n[        R                  " X5      $ ra  )	r  r   r   r<  r:  rA  r?  r  r  rb  s       r.   r  !SymmetricalLogLocator.view_limits^
  se    JJ;$<<-./A%d.D(1D|#D,&t/&&t22r1   )r  r  rP  r  NNNNr  r  rL   r1   r.   r    r    	  s#     D,T9l3r1   r    c                   N   ^  \ rS rSrSr  SU 4S jjr  S	S jrS rS rSr	U =r
$ )
r!   in
  z
Place ticks spaced evenly on an inverse-sinh scale.

Generally used with the `~.scale.AsinhScale` class.

.. note::

   This API is provisional and may be revised in the future
   based on early user feedback.
c                 ^   > [         TU ]  5         Xl        X l        X0l        X@l        XPl        g)a  
Parameters
----------
linear_width : float
    The scale parameter defining the extent
    of the quasi-linear region.
numticks : int, default: 11
    The approximate number of major ticks that will fit
    along the entire axis
symthresh : float, default: 0.2
    The fractional threshold beneath which data which covers
    a range that is approximately symmetric about zero
    will have ticks that are exactly symmetric.
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 : tuple, default: None
    Multiples of the number base, typically used
    for the minor ticks, e.g. (2, 5) when base=10.
N)r   r/   linear_widthr  	symthreshr  rJ  )r,   r  r  r  r  rJ  r   s         r.   r/   AsinhLocator.__init__y
  s*    0 	( "		r1   c                 r    Ub  Xl         Ub  X l        Ub  X0l        Ub  [        U5      S:  a  UOSU l        gg)r  Nr   )r  r  r  r   rJ  )r,   r  r  r  rJ  s        r.   ro  AsinhLocator.set_params
  sC     $M &NI #D	A4DI r1   c                 
   U R                   R                  5       u  pX-  S:  aO  [        SX!-  -   5      U R                  :  a1  [	        [        U5      [        U5      5      nU R                  U* U5      $ U R                  X5      $ rp  )rY   r6   r  r  r8  rk  )r,   r;   r<   bounds       r.   rj   AsinhLocator.__call__
  sp    YY002
K1Q_!5!FD	3t9-E##UFE22##D//r1   c                 0   U R                   [        R                  " [        R                  " X/5      U R                   -  5      -  u  p4[        R                  " X4U R
                  5      n[        XTU-
  -  5      nX4-  S:  a*  [        R                  " XVSU R
                  -  :     S/5      nU R                   [        R                  " XPR                   -  5      -  nUS:H  n[        R                  " SS9   U R                  S:  a  [        R                  " U5      U R                  [        R                  " [        R                  " [        U5      5      [        R                  " U R                  5      -  5      -  -  n	U R                  (       a.  [        R                   " XR                  5      R#                  5       OU	n
Og[        R$                  " USS[        R                  " [        R&                  " [        U5      5      5      -  5      n	U	[        R(                  " Xy-  5      -  n
S S S 5        [        R                  " [+        [-        W
5      5      5      n[/        U5      S:  a  U$ [        R                  " XU R
                  5      $ ! , (       d  f       Nh= f)	Nr   r  r  ignore)divider(   rB  r#  )r  r.  arcsinhr  r  r  r  hstacksinherrstater  rk  rE  r  rD  rJ  outerflattenwhererF  rG  r`  r  r   )r,   r;   r<   yminymaxyszero_devxszero_xspowsqsr  s               r.   rk  AsinhLocator.tick_values
  s   &&BHHd\4J6:6G6G5H *I I
[[T]]3rD[)*;?B3+> >@#FGB .?.?)?!@@7 [[)yy1}))rxxs2w$((499BU0U'VVW<@IIRXXdII.6684xxB#b'9J0K,KLBHHRY// * B)E
auSR[[T]]-SS *)s   3D2J
J)r  r  r  rJ  r  )r  g?rB  Nr  )rP   rQ   rR   rS   r   r/   ro  rj   rk  rT   r   r   s   @r.   r!   r!   n
  s4    	 =@#> 37#'
80T Tr1   r!   c                      ^  \ rS rSrSrSSS.U 4S jjjrSU 4S jjr\S 5       r\R                  S 5       rU 4S	 jr
S
 rSrU =r$ )r"   i
  z-
Place ticks spaced evenly on a logit scale.
r  r  c                2   > Xl         [        TU ]	  U/ SQS9  g)z
Parameters
----------
nbins : int or 'auto', optional
    Number of ticks. Only used if minor is False.
minor : bool, default: False
    Indicate if this locator is for minor ticks or not.
r(   r#  r[  rB  r  r  N)r  r   r/   )r,   r  r  r   s      r.   r/   LogitLocator.__init__
  s     uM:r1   c                 8   > Ub  Xl         [        TU ]  " S0 UD6  g)r  NrL   )r  r   ro  )r,   r  r^   r   s      r.   ro  LogitLocator.set_params
  s    K$V$r1   c                     U R                   $ r3   r  r5   s    r.   r  LogitLocator.minor
  s    {{r1   c                 "    U R                  US9  g )N)r  )ro  ru   s     r.   r  r  
  s    e$r1   c                   > [        U R                  S5      (       a/  U R                  R                  R                  S:X  a  [	        S5      eU R
                  S:X  a3  U R                  b#  U R                  R                  5       nUS:  a  SnOSnOU R
                  nS nU R                  X5      u  p[        US:  a*  [        R                  " [        R                  " U5      5      O5US	:  a  S
O-[        R                  " [        R                  " SU-
  5      5      * 5      n[        US::  a*  [        R                  " [        R                  " U5      5      O5US	::  a  SO-[        R                  " [        R                  " SU-
  5      5      * 5      nXe-
  S-
  nUS:  Ga  Xs:  a  [        R                  " Xs-  5      nU R                  (       a/  [        XVS-   5       V	s/ s H  n	X-  S
:w  d  M  U" U	5      PM     n
n	O.[        XVS-   5       V	s/ s H  n	X-  S
:X  d  M  U" U	5      PM     n
n	U R!                  [        R"                  " U
5      5      $ U R                  (       Ga  / n
[        XV5       H  n	U	S:  a.  U
R%                  [        R&                  " SS5      SU	-  -  5        M7  U	S:X  a+  U
R%                  [        R&                  " SS5      S-  5        Mh  U	S
:X  a+  U
R%                  [        R&                  " SS5      S-  5        M  U
R%                  S[        R&                  " SS5      S S S2   SU	* S-
  -  -  -
  5        M     U R!                  [        R"                  " U
5      5      $ [        XVS-   5       V	s/ s H
  o" U	5      PM     n
n	U R!                  [        R"                  " U
5      5      $ U R                  (       a  / $ [(        TU ]U  X5      $ s  sn	f s  sn	f s  sn	f )Nr3  polarz%Polar axis cannot be logit scaled yetr  r#  rK   c                 :    U S:  a  SU -  $ U S:  a	  SSU * -  -
  $ S$ )Nr   rB  r(   r  rL   rE  s    r.   ideal_ticks-LogitLocator.tick_values.<locals>.ideal_ticks
  s-    !e27KQUbaRj)9KKr1   r  r  r   r(   r+  rB  r[  r  )r  rY   r3  r  rf   r  rM   r  rz  r.  rE  rF  re  rD  r  r  rx  r  rv  r  r   rk  )r,   r;   r<   r  r  binfbsupnumidealsubsampling_factorr  r  r   s              r.   rk  LogitLocator.tick_values
  sE   499f%%$))..*=*=*H%&MNN;;& yy$		00219EKKE
	L %%d1
cz HHRXXd^$ cz ''"((1t8,--
 s{ GGBHHTN# s{ ((288AH-..
 ;?q= &*YYx/?%@";; "'tAX!6 !6A2q8 'A!6   H "'tAX!6 !6A2q8 'A!6   
 ,,RXXh-?@@{{{t*A2v 		!R(827(BCb 		!Q"(<=a 		!Q"(<= 		!R 02 6Q GG + ,,RXXh-?@@05d1H0EF0E1A0EHF((();<<;;Iw"4..?  ( Gs   O+O
OO7Oc                    SnUSU-
  4nX:  a  X!p![         R                  " U5      (       a  [         R                  " U5      (       d  Uu  pX4$ US::  d  US:  a  [        R                  " S5        Uu  pX4$ U R                  b  U R                  R                  5       OUn[         R                  " U5      (       d  UnUS::  a  UnUS:  a  SU-
  nX:X  a  SU-  SSU-  -
  p!X4$ )Nr  r(   r   zIData has no values between 0 and 1, and therefore cannot be logit-scaled.r  )r.  r6  r   r  rY   rA   )r,   r;   r<   standard_minposinitial_ranger-   s         r.   r  LogitLocator.nonsingular7  s    (!o*=>;${{4  D(9(9&JD8 z7 QY$!)   'JD( z! 99( 		$$&$ 
 ;;v&&(qy
 qy6z| 4ZS4Zdzr1   r  )Fr3   )rP   rQ   rR   rS   r   r/   ro  r  r  rh  rk  r  rT   r   r   s   @r.   r"   r"   
  s[    ;V ; ;%   \\% %K/Z" "r1   r"   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )r   i\  z
Place evenly spaced ticks, with the step size and maximum number of ticks chosen
automatically.

This is a subclass of `~matplotlib.ticker.MaxNLocator`, with parameters
*nbins = 'auto'* and *steps = [1, 2, 2.5, 5, 10]*.
c                 j   > [         R                  S   (       a  Sn/ SQnOSn/ SQn[        TU ]  XS9  g)zz
To know the values of the non-public parameters, please have a
look to the defaults of `~matplotlib.ticker.MaxNLocator`.
r  rK   r  r  )r(   r#  r  r[  rB  r  N)r   r   r   r/   )r,   r  r  r   s      r.   r/   AutoLocator.__init__d  s6    
 <<01E!EE&Eu2r1   rL   )rP   rQ   rR   rS   r   r/   rT   r   r   s   @r.   r   r   \  s    3 3r1   r   c                   .    \ rS rSrSrSS jrS rS rSrg)	r   ir  z
Place evenly spaced minor ticks, with the step size and maximum number of ticks
chosen automatically.

The Axis must use a linear scale and have evenly spaced major ticks.
Nc                     Xl         g)a  
Parameters
----------
n : int or 'auto', default: :rc:`xtick.minor.ndivs` or :rc:`ytick.minor.ndivs`
    The number of subdivisions of the interval between major ticks;
    e.g., n=2 will place a single minor tick midway between major ticks.

    If *n* is 'auto', it will be set to 4 or 5: if the distance
    between the major ticks equals 1, 2.5, 5 or 10 it can be perfectly
    divided in 5 equidistant sub-intervals with a length multiple of
    0.05; otherwise, it is divided in 4 sub-intervals.
Nndivs)r,   rm  s     r.   r/   AutoMinorLocator.__init__z  s	     
r1   c                 R   U R                   R                  5       S:X  a  [        R                  " S5        / $ [        R
                  " U R                   R                  5       5      n[        U5      S:  a  / $ US   US   -
  nU R                  c4  [        R                  U R                   R                  S:X  a  SOS   U l        U R                  S	:X  aM  S
[        R                  " U5      S-  -  n[        R                  " U/ SQ5      R                  5       (       a  SOSnOU R                  nX$-  n[        U R                   R!                  5       5      u  pgUS   n[#        Xh-
  U-  5      n	[#        Xx-
  U-  5      S-   n
[        R$                  " X5      U-  U-   nU R'                  U5      $ )Nr  z4AutoMinorLocator does not work on logarithmic scalesr#  r(   r   r  zytick.minor.ndivszxtick.minor.ndivsr  rB  )r(   r  r[  rB  r[  r	  )rY   	get_scaler   r  r.  uniqueget_majorticklocsr   r  r   r   	axis_namerF  r7  r  r`  r6   rG  r  rx  )r,   	majorlocs	majorstepmajorstep_mantissar  	minorstepr;   r<   t0tmintmaxr   s               r.   rj   AutoMinorLocator.__call__  si   99 E)UVIIIdii99;<	y>A IaL9Q</	::'+yy':':c'A#(*DJ ::!#(;a(?!@$6HLLNNATUEJJE%	DII779:
q\di9,-di9,-1		$%	1R7$$T**r1   c                 D    [        S[        U 5      R                   35      e)Nz Cannot get tick locations for a )rf   rn  rP   r:   s      r.   rk  AutoMinorLocator.tick_values  s&    !.tDz/B/B.CDF 	Fr1   r  r3   )	rP   rQ   rR   rS   r   r/   rj   rk  rT   rL   r1   r.   r   r   r  s    !+FFr1   r   )r(   rf  ):r   rg  loggingr   rD  numbersr   stringnumpyr.  r  r   r   r   r   r  	getLoggerrP   rv  __all__r$   r   r   r
   r	   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r   r  r<  r:  rA  r?  r  r   r    r!   r"   r   r   rL   r1   r.   <module>r     s  BH         " 0"	D 8- -=
 =@I !Y !D!I !8 0	M&** 	MD D8E>i E>PN9 Nb< ,J< ,J^32 3 A"Y A"HH+? H+Vky k\W3j W3tA7 A:*,7 *,Z' (N3G N3bC3g C3L, ,^Z' Zz 4 
787%w wtW3G W3tYT7 YTxO; Od3+ 3,<Fw <Fr1   