
    \cgբ                    |   d Z ddlZddlZddlZddlZddlmZ ddlZddlZ	ddl
Zddl
mZmZ ddl
mZ  ej                   e      ZdZ G d d      Z G d	 d
      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d dej,                        Z G d de      Z G d de      Z G d de      Z G d de      Z G d d e      Z  G d! d"e       Z! G d# d$e      Z" G d% d&e      Z# G d' d(e      Z$ G d) d*e      Z% G d+ d,e%      Z& G d- d.e%      Z' G d/ d0e%      Z( G d1 d2e%      Z) G d3 d4e%      Z*dNd5Z+ G d6 d7      Z, G d8 d9e%      Z-d:dd;d<Z.d= Z/d> Z0d? Z1d@ Z2dA Z3 G dB dCe%      Z4 G dD dEe%      Z5 G dF dGe%      Z6 G dH dIe-      Z7 G dJ dKe-      Z8 G dL dMe%      Z9y)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                   <    e Zd ZdZ d
dZd Zd Zd Zd Zd Zd Z	y	)
_DummyAxisdummyc                 .    d| _         d| _        || _        y )N)r      )_data_interval_view_interval_minpos)selfminposs     L/var/www/html/bid-api/venv/lib/python3.12/site-packages/matplotlib/ticker.py__init__z_DummyAxis.__init__   s    $$    c                     | j                   S Nr)   r+   s    r-   get_view_intervalz_DummyAxis.get_view_interval       """r/   c                     ||f| _         y r1   r2   r+   vminvmaxs      r-   set_view_intervalz_DummyAxis.set_view_interval       #Tlr/   c                     | j                   S r1   )r*   r3   s    r-   
get_minposz_DummyAxis.get_minpos       ||r/   c                     | j                   S r1   r(   r3   s    r-   get_data_intervalz_DummyAxis.get_data_interval   r5   r/   c                     ||f| _         y r1   r@   r7   s      r-   set_data_intervalz_DummyAxis.set_data_interval   r;   r/   c                      y)N	    r3   s    r-   get_tick_spacez_DummyAxis.get_tick_space   s    r/   Nr   )
__name__
__module____qualname__r.   r4   r:   r=   rA   rC   rG   rF   r/   r-   r$   r$      s*    H
#+#+r/   r$   c                       e Zd ZdZd Zd Zy)r   Nc                     || _         y r1   )axis)r+   rN   s     r-   set_axiszTickHelper.set_axis   s	    	r/   c                 >    | j                   t        di || _         y y )NrF   )rN   r$   r+   kwargss     r-   create_dummy_axiszTickHelper.create_dummy_axis   s     99",V,DI r/   )rI   rJ   rK   rN   rO   rS   rF   r/   r-   r   r      s    D-r/   r   c                   P    e Zd ZdZg ZddZd Zd Zd Zd Z	d Z
ed	        Zd
 Zy)r   z=
    Create a string based on a tick value and location.
    Nc                     t        d      )z
        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__zFormatter.__call__   s    
 ""9::r/   c                 z    | j                  |       t        |      D cg c]  \  }} | ||       c}}S c c}}w )z1Return the tick labels for all the ticks at once.)set_locs	enumerate)r+   valuesivalues       r-   format_tickszFormatter.format_ticks   s7    f/8/@A/@81eUA/@AAAs   7c                 $    | j                  |      S )zk
        Return the full string representation of the value with the
        position unspecified.
        )r\   r+   rb   s     r-   format_datazFormatter.format_data   s    
 }}U##r/   c                 $    | j                  |      S )z|
        Return a short string version of the tick value.

        Defaults to the position-independent long value.
        rf   re   s     r-   format_data_shortzFormatter.format_data_short   s     &&r/   c                      yN rF   r3   s    r-   
get_offsetzFormatter.get_offset   s    r/   c                     || _         y)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+   rp   s     r-   r^   zFormatter.set_locs   s     	r/   c                 P    t         j                  d   r| j                  dd      S | S )a  
        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_minuszFormatter.fix_minus   s/     << 45 		#/0 		r/   c                      y)z6Subclasses may want to override this to set a locator.NrF   )r+   locators     r-   _set_locatorzFormatter._set_locator  s    r/   r1   )rI   rJ   rK   __doc__rp   r\   rc   rf   ri   rm   r^   staticmethodrx   r{   rF   r/   r-   r   r      sF    
 D;B
$' 	 	r/   r   c                       e Zd ZdZddZy)r
   zAlways return the empty string.Nc                      yrk   rF   rY   s      r-   r\   zNullFormatter.__call__
  s    r/   r1   )rI   rJ   rK   r|   r\   rF   r/   r-   r
   r
     s
    )r/   r
   c                   *    e Zd ZdZd ZddZd Zd Zy)r	   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                      || _         d| _        y)z?Set the sequence *seq* of strings that will be used for labels.rl   N)seqoffset_string)r+   r   s     r-   r.   zFixedFormatter.__init__  s    r/   Nc                 V    ||t        | j                        k\  ry| j                  |   S )a  
        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.
        rl   )lenr   rY   s      r-   r\   zFixedFormatter.__call__  s)     ;#TXX.88C= r/   c                     | j                   S r1   r   r3   s    r-   rm   zFixedFormatter.get_offset*      !!!r/   c                     || _         y r1   r   r+   ofss     r-   set_offset_stringz FixedFormatter.set_offset_string-  
     r/   r1   rI   rJ   rK   r|   r.   r\   rm   r   rF   r/   r-   r	   r	     s     
!"!r/   r	   c                   *    e Zd ZdZd ZddZd Zd Zy)r   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                      || _         d| _        y rk   )funcr   )r+   r   s     r-   r.   zFuncFormatter.__init__:  s    	r/   Nc                 &    | j                  ||      S )zq
        Return the value of the user defined function.

        *x* and *pos* are passed through as-is.
        )r   rY   s      r-   r\   zFuncFormatter.__call__>  s     yyC  r/   c                     | j                   S r1   r   r3   s    r-   rm   zFuncFormatter.get_offsetF  r   r/   c                     || _         y r1   r   r   s     r-   r   zFuncFormatter.set_offset_stringI  r   r/   r1   r   rF   r/   r-   r   r   1  s     !"!r/   r   c                       e Zd ZdZd ZddZy)r   a  
    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                     || _         y r1   fmtr+   r   s     r-   r.   zFormatStrFormatter.__init__Y  	    r/   Nc                      | j                   |z  S )zw
        Return the formatted label string.

        Only the value *x* is formatted. The position is ignored.
        r   rY   s      r-   r\   zFormatStrFormatter.__call__\  s     xx!|r/   r1   rI   rJ   rK   r|   r.   r\   rF   r/   r-   r   r   M  s    	r/   r   c                   "     e Zd ZdZ fdZ xZS )_UnicodeMinusFormata.  
    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                 J    t         j                  t        |   ||            S r1   )r   rx   superformat_field)r+   rb   format_spec	__class__s      r-   r   z _UnicodeMinusFormat.format_fieldm  s     ""57#7{#KLLr/   )rI   rJ   rK   r|   r   __classcell__r   s   @r-   r   r   e  s    M Mr/   r   c                       e Zd ZdZd ZddZy)r   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                     || _         y r1   r   r   s     r-   r.   zStrMethodFormatter.__init__  r   r/   Nc                 N    t               j                  | j                  ||      S )z
        Return the formatted label string.

        *x* and *pos* are passed to `str.format` as keyword arguments
        with those exact names.
        )rZ   r[   )r   formatr   rY   s      r-   r\   zStrMethodFormatter.__call__  s#     #$++DHHs+CCr/   r1   r   rF   r/   r-   r   r   q  s    Dr/   r   c                       e Zd ZdZddddZd Zd Z eee      Zd Z	d	 Z
 ee	e
      Zd
 Zd Z eee      Zd Zd Zd Z eee      ZddZd Zd Zd Zd Zd Zd Zd Zd Zd Zy)r   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                @   |t         j                  d   }t         j                  d   | _        | j                  |       | j	                  |       | j                  |       d| _        d| _        d| _        t         j                  d   | _	        | j                  |       y )Nzaxes.formatter.useoffsetzaxes.formatter.offset_thresholdr   rl   Tzaxes.formatter.limits)rt   ru   _offset_thresholdset_useOffset
set_usetexset_useMathTextorderOfMagnituder   _scientific_powerlimitsset_useLocale)r+   	useOffsetuseMathText	useLocaler   s        r-   r.   zScalarFormatter.__init__  s    %?@ILL:; 	9%[) !LL)@A9%r/   c                     | j                   S r1   )_usetexr3   s    r-   
get_usetexzScalarFormatter.get_usetex  r>   r/   c                 :    t        j                  |d      | _        y )Ntext.usetex)rt   
_val_or_rcr   r+   vals     r-   r   zScalarFormatter.set_usetex  s    ~~c=9r/   )fgetfsetc                     | j                   S )a$  
        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
        )
_useOffsetr3   s    r-   get_useOffsetzScalarFormatter.get_useOffset  s     r/   c                 F    |dv rd| _         || _        yd| _        || _         y)a  
        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   zScalarFormatter.set_useOffset  s(    6 -DK!DO#DODKr/   c                     | j                   S )z
        Return whether locale settings are used for formatting.

        See Also
        --------
        ScalarFormatter.set_useLocale
        )
_useLocaler3   s    r-   get_useLocalezScalarFormatter.get_useLocale  s     r/   c                 H    |t         j                  d   | _        y|| _        y)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)rt   ru   r   r   s     r-   r   zScalarFormatter.set_useLocale  s!     ;!ll+FGDO!DOr/   c                     | j                  | j                  rU| j                  r-dj                  fd|j	                  d      D                    S t        j                  |fd            S |z        S )zX
        Format *arg* with *fmt*, applying Unicode minus and locale if desired.
        ,c              3   n   K   | ],  }t        j                  |fd       j                  dd       . yw)Tr   z{,}N)localeformat_stringrv   ).0partargs     r-   	<genexpr>zAScalarFormatter._format_maybe_minus_and_locale.<locals>.<genexpr>-  s8      6&4d !..tcVTBJJ3PUV&4s   25T)rx   r   _useMathTextjoinsplitr   r   )r+   r   r   s     `r-   _format_maybe_minus_and_localez.ScalarFormatter._format_maybe_minus_and_locale&  s     ~~ ?? :>9J9J  6&)iin6 6  	 
 **3=  	  3Y  	 r/   c                     | j                   S )z
        Return whether to use fancy math formatting.

        See Also
        --------
        ScalarFormatter.set_useMathText
        )r   r3   s    r-   get_useMathTextzScalarFormatter.get_useMathText3  s        r/   c                 l   |t         j                  d   | _        | j                  du rs	 ddlm} |j                  |j                  t         j                  d         d      }|t        t        j                  d	            k(  rt        j                  d
       yyy|| _        y# t        $ r d}Y Nw xY w)a  
        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)rt   ru   r   
matplotlibr   findfontFontProperties
ValueErrorstrr   _get_data_pathr   warn_external)r+   r   r   ufonts       r-   r   zScalarFormatter.set_useMathText=  s     ; #-J KD  E)	!7(11$33#&<<#> 4  -2	 2 E C 4 45J KLL&&L M *$ !$D " ! E!s   :B% %B32B3c                     t        | j                        dk(  ry|| j                  z
  d| j                  z  z  }t	        |      dk  rd}| j                  | j                  |      S )zI
        Return the format for tick value *x* at position *pos*.
        r   rl         $@:0yE>)r   rp   r   r   absr   r   r+   rZ   r[   xps       r-   r\   zScalarFormatter.__call__`  s[     tyy>Qdkk/cT-B-B&BCB2w~66t{{BGGr/   c                 $    t        |      | _        y)z
        Turn scientific notation on or off.

        See Also
        --------
        ScalarFormatter.set_powerlimits
        N)boolr   )r+   bs     r-   set_scientificzScalarFormatter.set_scientificl  s      7r/   c                 D    t        |      dk7  rt        d      || _        y)a  
        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_powerlimitszScalarFormatter.set_powerlimitsv  s#    < t9>DEE r/   c                 H   |t         j                  j                  u ryt        |t              rd}n`t        | j                  dd      dv r| j                  j                  dk(  ri| j                  j                  j                         }|j                         }|j                  |df      }|j                  |ddgddggz         d d df   }nh| j                  j                  j                         }|j                         }|j                  d|f      }|j                  |ddgddggz         d d df   }t        ||z
        j                         }n%| j                  j                         \  }}	|	|z
  d	z  }d
t!        j"                  ||       d}| j%                  ||      S )Nrl   %drI   )xaxisyaxisr   r   r'        @z%-#.g)npmamasked
isinstancer   getattrrN   rI   axesget_xaxis_transforminverted	transformget_yaxis_transformr   maxr4   r   _g_sig_digitsr   )
r+   rb   r   axis_trfaxis_inv_trf	screen_xyneighbor_valuesdeltaar   s
             r-   ri   z!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Oe3488: yy2241Q#,,UE:;1=C223>>r/   c                 V   t        j                  t        j                  t        |                  }t	        |d|z  z  d      }| j                  |dz  dk(  rdnd|      }|dk(  r|S | j                  d|      }| j                  s| j                  rd|z  }|dk(  r|S | d| S | d| S )	N
   r'   r   r   z%1.10gz10^{%s}z \times e)mathfloorlog10r   roundr   r   r   )r+   rb   r  rw   significandexponents         r-   rf   zScalarFormatter.format_data  s    JJtzz#e*-.%"a%-$99EQJDHa1666tQ? 8+H !QH >(M(<> "]!H:..r/   c                 (   t        | j                        dk(  ry| j                  s| j                  rd}d}| j                  r/| j	                  | j                        }| j                  dkD  rd|z   }| j                  rF| j
                  s| j                  r| j	                  d| j                  z        }nd| j                  z  }| j                  s| j
                  r|dk7  rd|z  }d| d| d	}ndj                  ||f      }| j                  |      S y)
z:
        Return scientific notation, plus offset.
        r   rl   +r  z1e%dz\times\mathdefault{%s}$z\mathdefault{z}$)	r   rp   r   r   rf   r   r   r   rx   r+   	offsetStr	sciNotStrrw   s       r-   rm   zScalarFormatter.get_offset  s     tyy>Q  DKKII{{ ,,T[[9	;;? #iI$$<<4#4#4 $ 0 0t7L7L1L MI &)>)> >I  DLL? 9I EI>)C@GGY	23>>!$$r/   c                     || _         t        | j                         dkD  r=| j                  r| j                          | j	                          | j                          y y )Nr   )rp   r   r   _compute_offset_set_order_of_magnitude_set_formatrq   s     r-   r^   zScalarFormatter.set_locs  sI    	tyy>A$$&((*	 r/   c                   
 | j                   }t        | j                  j                               \  }}t	        j
                  |      }|||k  ||k  z     }t        |      sd| _        y |j                         |j                         }}||k(  s|dcxk  r|k  rd| _        y  nd| _        y t        t        t        |            t        t        |            g      \  
t        j                  d|      }t	        j                  t        j                  
            }dt!        
fdt#        j$                  |d      D              z   }
z
  d|z  z  dk  r,dt!        
fdt#        j$                  |d      D              z   }| j&                  dz
  }	
d|z  z  d|	z  k\  r|
d|z  z  z  d|z  z  | _        y d| _        y )Nr   r'   c              3   D   K   | ]  }d |z  z  d |z  z  k7  r|  yw)r  NrF   r   oomabs_maxabs_mins     r-   r   z2ScalarFormatter._compute_offset.<locals>.<genexpr>   s4      H&Bs!R3Y.'R3Y2FF &Bs    r   r  {Gz?c              3   J   K   | ]  }d |z  z  d |z  z  z
  dkD  r|  yw)r  r'   NrF   r"  s     r-   r   z2ScalarFormatter._compute_offset.<locals>.<genexpr>  s9      O*F3%s2Wc	5IIAM *Fs    #)rp   sortedrN   r4   r   asarrayr   r   minr  r   floatr  copysignceilr  next	itertoolscountr   )r+   rp   r8   r9   lminlmaxsignoom_maxr#  nr$  r%  s             @@r-   r  zScalarFormatter._compute_offset  s   yyDII779:
dzz$TT\ddl344yDKXXZd 4<41,,DK -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@ 	r/   c                    | j                   sd| _        y | j                  d   | j                  d   cxk(  rdk7  rn n| j                  d   | _        y t        | j                  j                               \  }}t        j                  | j                        }|||k  ||k  z     }t        j                  |      }t        |      sd| _        y | j                  r,t        j                  t        j                  ||z
              }n@|j                         }|dk(  rd}n(t        j                  t        j                  |            }|| j                  d   k  r|| _        y || j                  d   k\  r|| _        y d| _        y Nr   r'   )r   r   r   r(  rN   r4   r   r)  rp   r   r   r   r  r  r  r  )r+   r8   r9   rp   r#  r   s         r-   r  z'ScalarFormatter._set_order_of_magnitude  sA    $%D!Q4#4#4Q#7<1<$($5$5a$8D!DII779:
dzz$))$TT\ddl34vvd|4y$%D!;;**TZZt45C((*CaxjjC1$##A&&$'D!D%%a(($'D!$%D!r/   c                 x   t        | j                        dk  r)g | j                  | j                  j                         }n| j                  }t	        j
                  |      | j                  z
  d| j                  z  z  }t	        j                  |      }|dk(  r(t	        j                  t	        j                  |            }|dk(  rd}t        | j                        dk  r|d d }t        t        j                  t        j                  |                  }t        dd|z
        }dd|z  z  }|dk\  rKt	        j                  |t	        j                  ||	      z
        j                         |k  r|dz  }nn|dk\  rK|dz  }d
| d| _        | j"                  s| j$                  rd| j                   z  | _        y y )Nr   r   r   r'      MbP?r  )decimalsz%1.f$\mathdefault{%s}$)r   rp   rN   r4   r   r)  r   r   ptpr  r   intr  r  r  r  r   r   r   )r+   _locsrp   	loc_rangeloc_range_oomsigfigsthreshs          r-   r  zScalarFormatter._set_format1  st   tyy>A@dii@$))"="="?@EIIE

5!DKK/3$:O:O3OOFF4L	>rvvd|,I>Ityy>A9DDJJtzz)'<=>a]*+m++lvvdRXXdW==>BBDvM1	 l
 	1G9A&<<4,,/$++=DK -r/   )NNNr1   )rI   rJ   rK   r|   r.   r   r   propertyr   r   r   r   r   r   r   r   r   r   r   r\   r   r   ri   rf   rm   r^   r  r  r  rF   r/   r-   r   r     s    4l&&: :J7F D m-@I" m-@I !$B oFK
H# !D?8/ 6%N &D>r/   r   c                   R    e Zd ZdZ	 	 	 ddZd Zd ZddZd ZddZ	d	 Z
d
 Zd Zy)r   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                     | j                  |       | j                  |       |t        j                  d   rd}nd}|| _        d | _        || _        y )N_internal.classic_moder   r   )r'   g?)set_baseset_label_minorrt   ru   minor_thresholds
_sublabels
_linthresh)r+   baselabelOnlyBaserM  	linthreshs        r-   r.   zLogFormatter.__init__  sS     	d]+#||45#) #+  0#r/   c                 $    t        |      | _        y)z
        Change the *base* for labeling.

        .. warning::
           Should always match the base used for :class:`LogLocator`
        N)r+  _base)r+   rP  s     r-   rK  zLogFormatter.set_base  s     4[
r/   c                     || _         y)z
        Switch minor tick labeling on or off.

        Parameters
        ----------
        labelOnlyBase : bool
            If True, label ticks only at integer powers of base.
        NrQ  )r+   rQ  s     r-   rL  zLogFormatter.set_label_minor  s     +r/   c                 |   t        j                  | j                  d         rd| _        y| j                  }|%	 | j
                  j                         j                  }| j
                  j                         \  }}||kD  r||}}||dk  r	dh| _        y| j                  }|d}|| k  r>t        ||       }|t        j                  ||z        t        j                  |      z  z  }||kD  rt        ||      }|t        j                  ||z        t        j                  |      z  z  }ndt        j                  |      t        j                  |      z  }t        j                  |      t        j                  |      z  }t        ||z
        }|| j                  d   kD  r	dh| _        y|| j                  d   kD  rJt        j                   d|t#        |      dz  dz         }	t%        t        j&                  |	            | _        yt%        t        j(                  d|dz               | _        y# t        $ r Y w xY w)z
        Use axis view limits to control which ticks are labeled.

        The *locs* parameter is ignored in the present algorithm.
        r   Nr'   r   )r   isinfrM  rN  rO  rN   get_transformrR  AttributeErrorr4   rT  r*  r  logr  r   	geomspacer@  setr  arange)
r+   rp   rR  r8   r9   r   numdecrhslhscs
             r-   r^   zLogFormatter.set_locs  s    88D))!,-"DO OO	 II335??	 YY002
d$;t$D  !cDOJJ  Fyj $
+$((4#:.!<<i$	*$((4#:.!<<88D>DHHQK/D88D>DHHQK/D%FD))!,, cDOd++A.. Q3q619q=1A!"((1+.DO ""))Aq1u"56DOU " s   $H. .	H;:H;c                 P    d|cxk  rdk  rn n| j                  |||z
        S |dS )Nr'   '  z1.0e)_pprint_val)r+   rZ   r8   r9   s       r-   _num_to_stringzLogFormatter._num_to_string  s,    34?U?t4$;/S1T(Sr/   c                    |dk(  ryt        |      }| j                  }t        j                  |      t        j                  |      z  }t	        |      }|rt        |      nt        j                  |      }t        |||z
  z        }| j                  r|sy| j                  || j                  vry| j                  j                         \  }}	t        j                  ||	d      \  }}	| j                  |||	      }
| j                  |
      S )N        0rl   皙?expander)r   rT  r  r[  _is_close_to_intr  r   r  rQ  rN  rN   r4   mtransformsnonsingularrf  rx   )r+   rZ   r[   r   fxis_x_decader  coeffr8   r9   rw   s              r-   r\   zLogFormatter.__call__  s    8FJJXXa[488A;&&r* +59"aBM*+k??&5+GYY002
d ,,T4$G
d4.~~a  r/   c                     t        j                  | d      5  t        j                  | j                  |            cd d d        S # 1 sw Y   y xY w)NFrV  )r   _setattr_cm
strip_mathr\   re   s     r-   rf   zLogFormatter.format_data  s5    t59##DMM%$89 :99s   $AAc                 (    d|z  j                         S )Nz%-12g)rstripre   s     r-   ri   zLogFormatter.format_data_short	  s    %''))r/   c                    t        |      dk  r|t        |      k(  rd|z  S |dk  rdn|dk  rdn|dk  rdn|d	k  rd
nd}||z  }|j                  d      }t        |      dk(  r@|d   j	                  d      j	                  d      }t        |d         }|r	d||fz  }|S |}|S |j	                  d      j	                  d      }|S )Nr   r   r&  z%1.3er'   z%1.3fr  z%1.2fg     j@z%1.1fz%1.1er  r   r   ri  .z%se%d)r   r@  r   r   rw  )r+   rZ   dr   rw   tupmantissar  s           r-   re  z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r/   )r   FNNr1   )rI   rJ   rK   r|   r.   rK  rL  r^   rf  r\   rf   ri   re  rF   r/   r-   r   r   S  sB    7r 16"&$!	+97vT!.:*r/   r   c                       e Zd ZdZd Zy)r   J
    Format values for log axis using ``exponent = log_base(value)``.
    c                 >   t        j                  |      t        j                  | j                        z  }dt        |      cxk  rdk  rOn nLt        j                  ||z
        t        j                  | j                        z  }| j	                  ||      }|S |d}|S )Nr'   rd  z1.0g)r  r[  rT  r   re  )r+   rZ   r8   r9   rp  fdrw   s          r-   rf  z#LogFormatterExponent._num_to_string)  s    XXa[488DJJ//B 5 $+&$**)==B  R(A  d)Ar/   N)rI   rJ   rK   r|   rf  rF   r/   r-   r   r   $  s    r/   r   c                       e Zd ZdZd ZddZy)r   r~  c                     d|||fz  S )'Return string for non-decade locations.z$\mathdefault{%s%s^{%.2f}}$rF   )r+   sign_stringrP  rp  r   s        r-   _non_decade_formatz'LogFormatterMathtext._non_decade_format8  s    -dB0GGGr/   Nc                 b   |dk(  ry|dk  rdnd}t        |      }| j                  }t        j                  |      t        j                  |      z  }t	        |      }|rt        |      nt        j                  |      }t        |||z
  z        }| j                  r|sy| j                  || j                  vry|rt        |      }|dz  dk(  rd|z  }	nd|z  }	t        |      t        j                  d	   k  rd
||fz  S |s't        j                  d   }
| j                  ||	||
      S d||	|fz  S )Nr   z$\mathdefault{0}$rs   rl   r'   rh  r   z%szaxes.formatter.min_exponentz$\mathdefault{%s%g}$r   z$\mathdefault{%s%s^{%d}}$)r   rT  r  r[  rm  r  r   r  rQ  rN  rt   ru   r  )r+   rZ   r[   r  r   rp  rq  r  rr  rP  r   s              r-   r\   zLogFormatterMathtext.__call__<  s*   6'UcFJJ XXa[488A;&&r* +59"aBM*+k??&5+GrB q5C<!8D!8Dr7S\\"?@@*k1-===\\-0F**;b&II/;b2IIIr/   r1   )rI   rJ   rK   r|   r  r\   rF   r/   r-   r   r   3  s    H#Jr/   r   c                       e Zd ZdZd Zy)r   zL
    Format values following scientific notation in a logarithmic axis.
    c                     t        |      }t        j                  |      }|||z
  z  }t        |      rt	        |      }d||||fz  S )r  z!$\mathdefault{%s%g\times%s^{%d}}$)r+  r  r  rm  r  )r+   r  rP  rp  r   r   r  rr  s           r-   r  z*LogFormatterSciNotation._non_decade_formatg  sP    $K::b>b8m$E"%LE3E423 	3r/   N)rI   rJ   rK   r|   r  rF   r/   r-   r   r   b  s    3r/   r   c                   ^    e Zd ZdZdddddddZd Zd	 Zd
 Zd Zd Z	ddZ
d ZddZd Zy)r   z2
    Probability formatter (using Math text).
    Fz\frac{1}{2}      )use_overlineone_halfminorminor_thresholdminor_numberc                h    || _         || _        || _        t               | _        || _        || _        y)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.   zLogitFormatter.__init__w  s4    B *! /)r/   c                     || _         y)a  
        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  zLogitFormatter.use_overline  s     *r/   c                     || _         y)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_halfzLogitFormatter.set_one_half  s     "r/   c                     || _         y)a	  
        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_thresholdz"LogitFormatter.set_minor_threshold  s     !0r/   c                     || _         y)a  
        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_numberzLogitFormatter.set_minor_number  s     *r/   c                    t        j                        | _        | j                  j	                          | j
                  sy t        d D              ry t              | j                  k  rZt              | j                  k  r| j                  j                         y t        j                  t        j                  d| j                  z  dz
               }t        j                  t        j                  t         j                  f|f      t        j                  |t         j                  ff            t        j                  d|f      t        j                  |df      z   t!        t#        t        | j                              fd      | j                   d  }| j                  j                  fd|D               y y )Nc              3      K   | ]Y  }t        |d       xsF t        d|z
  d       xs4 t        d|z        xr$ t        t        j                  d|z              dk(   [ yw)Hz>rtolr'   r   N)
_is_decaderm  r@  r   r  )r   rZ   s     r-   r   z*LogitFormatter.set_locs.<locals>.<genexpr>  sj      

 	 qt$ +!a%d++ Q' *BHHQUO$)+ s   AA!r'   rH   c                     |    |    fS r1   rF   )ra   space_pessimistic	space_sums    r-   <lambda>z)LogitFormatter.set_locs.<locals>.<lambda>  s    #4Q#71"Fr/   )keyc              3   (   K   | ]	  }|     y wr1   rF   )r   ra   rp   s     r-   r   z*LogitFormatter.set_locs.<locals>.<genexpr>  s     %Bz!d1gzs   )r   arrayrp   r  clearr  allr   r  r  updatediffr[  minimumconcatenateinfr(  range)r+   rp   r  
good_minorr  r  s    `  @@r-   r^   zLogitFormatter.set_locs  sd   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 -r/   c                    |r+t        j                  t        j                  |            }d}nd}d}|d| z  z  }t	        |      dk  r|}nt        j
                  t        j                  ||z
              d   }t        j                  |       |z   }t        |      rt        t        j                  |            nt        j                  |      }||k  r|}d||fz  }	|s|	S d|	|fz  }
|
S )Nr   r'   r  r   z%.*fz%s\cdot10^{%d})r  r  r   r  r   sortr   rm  r@  r  r-  )r+   rZ   rp   sci_notationr  min_precisionrb   	precisionr  r|  rw   s              r-   _format_valuezLogitFormatter._format_value  s    zz"((1+.HMHMBH9%%t9q=%I77266$(+,Q/D$(2I $I. BHHY'(YYy) 
 =()	i//O8 44r/   c                 .    | j                   rd|z  S d| S )Nz\overline{%s}1-r  )r+   rw   s     r-   
_one_minuszLogitFormatter._one_minus  s!    #a''s8Or/   Nc                    | j                   r|| j                  vry|dk  s|dk\  ryt        d|z        r"t        d|z        dk(  r| j                  }d|z  S |dk  r5t        |d      r(t        t        j                  |            }d|z  }d|z  S |dkD  rJt        d|z
  d      r:t        t        j                  d|z
              }| j                  d|z        }d|z  S |d	k  r!| j                  || j                        }d|z  S |d
kD  r6| j                  | j                  d|z
  d| j                  z
              }d|z  S | j                  || j                  d      }d|z  S )Nrl   r   r'   r         ?r  r  z10^{%d}皙??F)r  r>  )r  r  rm  r  r  r  r  r  r  r  rp   )r+   rZ   r[   rw   r  s        r-   r\   zLogitFormatter.__call__  sq   ;;1DNN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""1dii0A
 %q((	 W 2 21Q3$)) DEA %q(( ""1diie"DA$q((r/   c                 8    |dk  r|dS |dk  r|dS dd|z
  dS )Nr  r  r  r=  r  r'   rF   re   s     r-   ri   z LogitFormatter.format_data_short,  s9     3;AY3;AYAIa=!!r/   )Tr1   )rI   rJ   rK   r|   r.   r  r  r  r  r^   r  r  r\   ri   rF   r/   r-   r   r   r  sM     &*P
*"
0*(CT4)*"r/   r   c                        e Zd ZdZi dddddddd	d
dddddddddddddddddddddd d!d"d#d$d%d&d'd(Zd2d)d)d*d+ fd,Zd3d-Zd. Zd/ Zd0 Z	d1 Z
 xZS )4r   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  ir=  ipir5  i   µmr   rl   r:  kr  MrE   G   T   P   EZYRQ)            NF)r   r   r   c                V    || _         || _        || _        t        |   ||d|       y)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+   r  r  r  r   r   r   r   s          r-   r.   zEngFormatter.__init__U  s9    Z 	#	 	 	
r/   c                 &   t        | j                        dk(  s| j                  dk(  r | j                  | j	                  |            S || j                  z
  d| j
                  z  z  }t        |      dk  rd}| j                  | j                  |      S )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   rp   r   rx   rf   r   r   r   r   r   s       r-   r\   zEngFormatter.__call__  s}     tyy>Q$++"2>>$"2"21"566dkk/cT-B-B&BCB2w~66t{{BGGr/   c                    || _         t        | j                         dkD  rt        | j                  j	                               \  }}| j
                  r6| j                          | j                  dk7  rt        ||z   dz  d      | _        t        j                  t        j                  ||z
  d            dz  | _        | j                          y y )Nr   r   r:    )rp   r   r(  rN   r4   r   r  r   r  r  r  r[  r   r  )r+   rp   r8   r9   s       r-   r^   zEngFormatter.set_locs  s    	tyy>A		 ; ; =>JD$$$&;;!# #(a";DK$(JJtxxtT/J$KA$MD! r/   c                    t        | j                        dk(  ry| j                  rd}| j                  r/| j                  | j                        }| j                  dkD  rd|z   }| j                  d| j                  z        }| j
                  s| j                  r|dk7  rd|z  }d| | d}n||z   }| j                  |      S y)Nr   rl   r  r  z\times%sr  )r   rp   r   rf   r   r   r   rx   r  s       r-   rm   zEngFormatter.get_offset  s    tyy>Q;;I{{ ,,T[[9	;;? #iI((t/D/D)DEI  DLL? +i 7I	{9+Q/	)>>!$$r/   c                 $    | j                  |      S )z!Alias to EngFormatter.format_datarh   )r+   nums     r-   
format_engzEngFormatter.format_eng  s    $$r/   c                    d}| j                   dnd| j                   dd}|dk  rd}| }|dk7  r8t        t        j                  t        j                  |      dz        dz        }nd}d	}t        j                  |t        | j                        t        | j                              }||z  d
|z  z  }t        t        t        ||                  dk\  r"|t        | j                        k  r
|dz  }|dz  }| j                  t        |         }| j                  s|r| j                   | | j                   }nd}| j                  s| j                   r
d|| d| S || | S )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   ry  rz  r=  r   r   r:  rh  r   r  rl   r  )r  r@  r  r  r  r   clipr*  ENG_PREFIXESr  r   r+  r   r  r  r   r   )r+   rb   r3  r   pow10mantunit_prefixsuffixs           r-   rf   zEngFormatter.format_data  sc    [[(c$++a.B19DFEA:

4::e#4q#89A=>EE Es4#4#45s4;L;L7MNe|tu}- fT3'()T1C 1 122DLDQJE''E
399z+tyyk:FF<<4,,tSEl!F8,,C5\&**r/   )rl   N r1   )rI   rJ   rK   r|   r  r.   r\   r^   rm   r  rf   r   r   s   @r-   r   r   6  s   SS 	S 	S	
 	S 	S 	S 
S 
 
S R S S S 
S  
S!" 
S#$ +L05
!U5
nH2(%2+r/   r   c                   `    e Zd ZdZd	dZd
dZd Zd Zed        Z	e	j                  d        Z	y)r   a  
    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                 B    |dz   | _         || _        || _        || _        y )Nrh  )xmaxr<  _symbol	_is_latex)r+   r  r<  symbolis_latexs        r-   r.   zPercentFormatter.__init__  s"    3J	 !r/   c                     | j                   j                         \  }}t        ||z
        }| j                  | j	                  ||            S )z=Format the tick as a percentage with the appropriate scaling.)rN   r4   r   rx   
format_pct)r+   rZ   r[   ax_minax_maxdisplay_ranges         r-   r\   zPercentFormatter.__call__!  s@    446FVO,~~dooa?@@r/   c                 B   | j                  |      }| j                  W| j                  |      }|dk  rd}nJt        j                  dt        j                  d|z        z
        }|dkD  rd}n|dk  rd}n| j                  }|dt        |       d}|| j                  z   S )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.r=  )convert_to_pctr<  r  r-  r  r@  r  )r+   rZ   r  scaled_ranger<  rw   s         r-   r  zPercentFormatter.format_pct'  s    , "== ..}=Lq   99S4::cL6H+I%IJa< H\ H}}HCM?!#$4;;r/   c                 &    d|| j                   z  z  S )Ng      Y@)r  )r+   rZ   s     r-   r   zPercentFormatter.convert_to_pctS  s    DII&&r/   c                     | j                   }|sd}|S | j                  s/t        j                  d   rdD ]  }|j	                  |d|z         } |S )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.
        rl   r   z
\#$%&~_^{}\)r  r  rt   ru   rv   )r+   r  specs      r-   r  zPercentFormatter.symbolV  sU     F  CLL$? &dTk: &r/   c                     || _         y r1   )r  )r+   r  s     r-   r  zPercentFormatter.symbolj  s	    r/   )d   N%Fr1   )rI   rJ   rK   r|   r.   r\   r  r   rF  r  setterrF   r/   r-   r   r     sI    2"A*X'  & ]] r/   r   c                   8    e Zd ZdZdZd Zd Zd Zd Zd Z	d Z
y	)
r   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                     t        d      )a  
        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]

        rV   rW   r7   s      r-   tick_valueszLocator.tick_values~  s     ""9::r/   c                 X    t        j                  dt        t        |             z          y)z
        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   typerQ   s     r-   
set_paramszLocator.set_params  s%    
 	=T
O	r/   c                     t        d      )"Return the locations of the ticks.rV   rW   r3   s    r-   r\   zLocator.__call__  s     ""9::r/   c                     t        |      | j                  k\  r2t        j                  dt        |      |d   |d   | j                         |S )a  
        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warningrq   s     r-   raise_if_exceedszLocator.raise_if_exceeds  sE     t9%LL7D	47DHdmm= r/   c                 2    t        j                  ||d      S )a1  
        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.
        rj  rk  rn  ro  )r+   v0v1s      r-   ro  zLocator.nonsingular  s     &&r2<<r/   c                 .    t        j                  ||      S )z
        Select a scale for the range from vmin to vmax.

        Subclasses should override this method to change locator behaviour.
        r  r7   s      r-   view_limitszLocator.view_limits  s     &&tT22r/   N)rI   rJ   rK   r|   r  r  r  r\   r  ro  r  rF   r/   r-   r   r   o  s,     H;";$= 3r/   r   c                   *    e Zd ZdZd ZddZd Zd Zy)r   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                      || _         || _        y)z:Place ticks every *base* data point, starting at *offset*.NrT  r   r+   rP  r   s      r-   r.   zIndexLocator.__init__  s    
r/   Nc                 *    ||| _         ||| _        yy)z"Set parameters within this locatorNr  r   s      r-   r  zIndexLocator.set_params  s!    DJ DK r/   c                 `    | j                   j                         \  }}| j                  ||      S )z!Return the locations of the ticks)rN   rA   r  r+   dmindmaxs      r-   r\   zIndexLocator.__call__  +    YY002
dd++r/   c                     | j                  t        j                  || j                  z   |dz   | j                              S )Nr'   )r  r   r^  r   rT  r7   s      r-   r  zIndexLocator.tick_values  s8    $$IIdT[[($(DJJ?A 	Ar/   NNrI   rJ   rK   r|   r.   r  r\   r  rF   r/   r-   r   r     s    
!,
Ar/   r   c                   ,    e Zd ZdZddZddZd Zd Zy)r   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                     t        j                  |      | _        t        j                  d| j                         |t        |d      | _        y d | _        y )Nr1   ro   r   )r   r)  rp   r   check_shaper  nbins)r+   rp   r-  s      r-   r.   zFixedLocator.__init__  s>    JJt$	tyy1&+&7S]
T
r/   c                     ||| _         yy#Set parameters within this locator.Nr-  )r+   r-  s     r-   r  zFixedLocator.set_params  s    DJ r/   c                 &    | j                  d d       S r1   r  r3   s    r-   r\   zFixedLocator.__call__      d++r/   c           	         | j                   | j                  S t        t        t	        j
                  t        | j                        | j                   z              d      }| j                  dd|   }t        d|      D ]^  }| j                  |d|   }t	        j                  |      j                         t	        j                  |      j                         k  s]|}` | j                  |      S )z
        Return the locations of the ticks.

        .. note::

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

        Nr'   )r-  rp   r  r@  r   r-  r   r  r   r*  r  )r+   r8   r9   stepticksra   ticks1s          r-   r  zFixedLocator.tick_values  s     ::993rwws499~

:;<a@		&D&!q$AYYqw$w'Fvvf~!!#bffUm&7&7&99   $$U++r/   r1   r)  rF   r/   r-   r   r     s    B

,,r/   r   c                       e Zd ZdZd Zd Zy)r   z
    No ticks
    c                 &    | j                  d d       S r1   r3  r3   s    r-   r\   zNullLocator.__call__  r4  r/   c                     g S )z
        Return the locations of the ticks.

        .. note::

            Because the values are Null, vmin and vmax are not used in this
            method.
        rF   r7   s      r-   r  zNullLocator.tick_values  s	     	r/   N)rI   rJ   rK   r|   r\   r  rF   r/   r-   r   r     s    ,	r/   r   c                   f    e Zd ZdZd
dZed        Zej                  d        Zd
dZd Z	d Z
d	 Zy)r   a  
    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                 4    || _         |i | _        y|| _        y)ao  
        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.   zLinearLocator.__init__1  s     !?DL"DLr/   c                 6    | j                   | j                   S dS )N   	_numticksr3   s    r-   r>  zLinearLocator.numticksB  s     "&!;t~~CCr/   c                     || _         y r1   rC  )r+   r>  s     r-   r>  zLinearLocator.numticksG  s	    !r/   c                 *    ||| _         ||| _        yyr/  )r?  r>  r@  s      r-   r  zLinearLocator.set_paramsK  s!    "DL$DM  r/   c                 `    | j                   j                         \  }}| j                  ||      S r  rN   r4   r  r7   s      r-   r\   zLinearLocator.__call__R  r&  r/   c                     t        j                  ||d      \  }}||f| j                  v r| j                  ||f   S | j                  dk(  rg S t	        j
                  ||| j                        }| j                  |      S )Nrj  rk  r   )rn  ro  r?  r>  r   linspacer  )r+   r8   r9   ticklocss       r-   r  zLinearLocator.tick_valuesW  su     ,,T4$G
d$<4<<'<<t--==AI;;tT4==9$$X..r/   c           	         ||k  r||}}||k(  r
|dz  }|dz  }t         j                  d   dk(  rt        t        j                  ||z
        t        j                  t        | j                  dz
  d                  \  }}||dk  z  }t        | j                  dz
  d      | z  }t        j                  ||z        |z  }t        j                  ||z        |z  }t        j                  ||      S ),Try to choose the view limits intelligently.r'   axes.autolimit_moderound_numbersr  )rt   ru   divmodr  r  r  r>  r  r-  rn  ro  )r+   r8   r9   r  	remainderscales         r-   r  zLinearLocator.view_limitsc  s     $;t$D4<AIDAID<<-./A"(

4$;'C8I14M)N#PHiR(H)1-8)<E::edl+e3D99UT\*U2D&&tT22r/   r(  )rI   rJ   rK   r|   r.   rF  r>  r	  r  r\   r  r  rF   r/   r-   r   r   '  sN    #" D D __" "%,

/3r/   r   c                   2    e Zd ZdZddZd	dZd Zd Zd Zy)
r   zI
    Place ticks at every integer multiple of a base plus an offset.
    c                 4    t        |d      | _        || _        y)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.   zMultipleLocator.__init__}  s     #4+
r/   Nc                 >    |t        |d      | _        ||| _        yy)a  
        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   rV  r   s      r-   r  zMultipleLocator.set_params  s*     &tQ/DJ!DL r/   c                 `    | j                   j                         \  }}| j                  ||      S rH  rI  r7   s      r-   r\   zMultipleLocator.__call__  r&  r/   c                 R   ||k  r||}}| j                   j                  }|| j                  z  }|| j                  z  }| j                   j                  |      |z  }||z
  d|z  z   |z  }||z
  t	        j
                  |dz         |z  z   | j                  z   }| j                  |      S )Nr;  r:  )rX  r6  rY  ger   r^  r  )r+   r8   r9   r6  r5  rp   s         r-   r  zMultipleLocator.tick_values  s    $;t$Dzzzz}}T"T)D[54<'D0d{RYYq1u-44t||C$$T**r/   c                    t         j                  d   dk(  r| j                  j                  || j                  z
        | j                  j
                  z  | j                  z   }| j                  j                  || j                  z
        | j                  j
                  z  | j                  z   }||k(  r|dz  }|dz  }n|}|}t        j                  ||      S )zW
        Set the view limits to the nearest tick values that contain the data.
        rO  rP  r'   )	rt   ru   rX  lerY  r6  r]  rn  ro  )r+   r$  r%  r8   r9   s        r-   r  zMultipleLocator.view_limits  s     <<-./A::==!45

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

G$,,VDt|		DD&&tT22r/   )      ?rh  r(  	rI   rJ   rK   r|   r.   r  r\   r  r  rF   r/   r-   r   r   x  s     "$,
	+3r/   r   c                 
   t        || z
        }|| z   dz  }t        |      |z  |k  rd}n8t        j                  dt        j                  t        |            dz  z  |      }dt        j                  ||z        dz  z  }||fS )Nr   r   r  r'   )r   r  r,  r  )r8   r9   r5  	thresholddvmeanvr   rS  s           r-   scale_rangerf    s    	TD[	BD[AE
5zB"rdjjU&<&ABEJ4::b1f%*+E&=r/   c                   (    e Zd ZdZd Zd Zd Zd Zy)rW  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    |dk  rt        d      || _        t        |      | _        y)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   r6  r   rY  )r+   r6  r   s      r-   r.   z_Edge_integer.__init__  s)     19677	6{r/   c                     | j                   dkD  rKt        j                  | j                   | j                  z        }t	        dd|dz
  z        }t        d|      }nd}t        ||z
        |k  S )Nr   g|=r  r  g<Nё\?)rY  r   r  r6  r  r*  r   )r+   msedgedigitstols        r-   closetoz_Edge_integer.closeto  sb    <<!XXdllTYY67FeRFRK01Cfc"CC29~##r/   c                     t        || j                        \  }}| j                  || j                  z  d      r|dz   S |S )z"Return the largest n: n*step <= x.r'   rQ  r6  rn  r+   rZ   rz  r  s       r-   r_  z_Edge_integer.le  s:    a#1<<DIIq)q5Lr/   c                     t        || j                        \  }}| j                  || j                  z  d      r|S |dz   S )z#Return the smallest n: n*step >= x.r   r'   rp  rq  s       r-   r]  z_Edge_integer.ge  s:    a#1<<DIIq)H1ur/   N)rI   rJ   rK   r|   r.   rn  r_  r]  rF   r/   r-   rW  rW    s    #$r/   rW  c                   r    e Zd ZdZ edddddd      ZddZed        Zed	        Z	d
 Z
d Zd Zd Zd Zy)r   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.
    r  NFr   )r-  stepsinteger	symmetricprunemin_n_ticksc                 R    |||d<    | j                   di i | j                  | y)aj  
        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-  rF   )r  default_params)r+   r-  rR   s      r-   r.   zMaxNLocator.__init__  s6    F #F7O<;T00;F;<r/   c                 |   t        j                  |       st        d      t        j                  |       } t        j                  t        j
                  |       dk        s| d   dkD  s| d   dk  rt        d      | d   dk7  rt        j                  dg| g      } | d   dk7  rt        j                  | dgg      } | S )NzSsteps argument must be an increasing sequence of numbers between 1 and 10 inclusiver   r   r  r'   )r   iterabler   r)  anyr  r  rt  s    r-   _validate_stepszMaxNLocator._validate_steps-  s    {{5! E F F

5!66"''%.A%&%)b.E!HqL E F F8q=NNQC<0E9?NNEB4=1Er/   c                 L    t        j                  d| d d z  | d| d   z  gg      S )Nr  r   r  r'   )r   r  r~  s    r-   
_staircasezMaxNLocator._staircase<  s/     ~~sU3BZ/eAhHIIr/   c                    d|v r?|j                  d      | _        | j                  dk7  rt        | j                        | _        d|v r|j                  d      | _        d|v r1|j                  d      }t	        j
                  g d|       || _        d|v r t        d|j                  d            | _        d	|v rf|j                  d	      }|t        j                  g d      | _        n| j                  |      | _        | j                  | j                        | _        d|v r|j                  d      | _        |rt	        j                   d|      y
)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-  autorv  rw  )upperlowerbothN)rw  rx  r'   rt  N)
r'   g      ?r         @r:     r  r     r  ru  r  )pop_nbinsr@  
_symmetricr   check_in_list_pruner  _min_n_ticksr   r  _stepsr  r  _extended_steps_integerkwarg_error)r+   rR   rw  rt  s       r-   r  zMaxNLocator.set_paramsB  s$   & f **W-DK{{f$!$++.& $jj5DOfJJw'E?uMDKF" #Avzz-'@ ADfJJw'E} hh'JK"2259#'??4;;#?D "JJy1DM""<88 r/   c                 
   | j                   dk(  rV| j                  Gt        j                  | j                  j	                         t        d| j                  dz
        d      }nd}n| j                   }t        |||      \  }}||z
  }||z
  }| j                  |z  }| j                  r9|dk  t        j                  |t        j                  |      z
        dk  z  }	||	   }||z
  |z  }
t        | j                  d      r+| j                  j                  j                  dk(  r|
dz  d	z  }
||
k\  }t        j                   d
   dk(  r||z  |z  }|||z  z   }|||k\  z  }t#        |      rt        j$                  |      d   d   }nt'        |      dz
  }|d|dz    ddd   D ]  }| j                  rGt        j(                  |      t        j*                  |      z
  | j                  dz
  k\  rt        d|      }||z  |z  }t-        ||      }|j/                  ||z
        }|j1                  ||z
        }t        j2                  ||dz         |z  |z   }||k  ||k\  z  j5                         }|| j                  k\  s ||z   S  |z   S )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'   rE   r;  r   3d   r  rO  rP  r   r   )r  rN   r   r  rG   r  r  rf  r  r  r   r  hasattrr   namert   ru   r}  nonzeror   r  r-  rW  r_  r]  r^  sum)r+   r8   r9   r-  rS  r   _vmin_vmaxrt  igoodraw_steplarge_stepsfloored_vminsfloored_vmaxsistepr6  	best_vminrk  lowhighr7  ntickss                         r-   
_raw_tickszMaxNLocator._raw_ticksm  s    ;;& yy$		 8 8 : #At'8'81'< =qB KKE#D$6vvv$$u,==QY266%"((5/*A#BU#JKE%LEU]e+499f%$))..*=*=*E  "}R'Hx'<<-./A #e^u4M)EEM9M%%)?@K {JJ{+A.q1EJNE
 (57ODbD)DHHUObggen48I8IA8MM1d|$$.I !v.D''%)+,C7759,-DIIc4!8,t3i?E~%5.9>>@F***v~' *& v~r/   c                 `    | j                   j                         \  }}| j                  ||      S r1   rI  r7   s      r-   r\   zMaxNLocator.__call__  s+    YY002
dd++r/   c                 2   | j                   r!t        t        |      t        |            }| }t        j                  ||dd      \  }}| j                  ||      }| j                  }|dk(  r|dd  }n|dk(  r|d d }n
|dk(  r|dd }| j                  |      S )	NvIh%<=g+=rl  tinyr  r'   r  r   r  )r  r  r   rn  ro  r  r  r  )r+   r8   r9   rp   rw  s        r-   r  zMaxNLocator.tick_values  s    ??s4y#d),D5D ,,$U4
dtT*G8Dg9Df_":D$$T**r/   c                     | j                   r!t        t        |      t        |            }| }t        j                  ||dd      \  }}t
        j                  d   dk(  r| j                  ||      ddg   S ||fS )Ng-q=r  r  rO  rP  r   r   )r  r  r   rn  ro  rt   ru   r  r#  s      r-   r  zMaxNLocator.view_limits  sy    ??s4y#d),D5D ,,$U4
d <<-./A??4.2w77:r/   r1   )rI   rJ   rK   r|   dictrz  r.   r}   r  r  r  r  r\   r  r  rF   r/   r-   r   r     sp      $"'$) $&')N%=N   J J
)9VCJ,+"r/   r   r  )rP  r  c                N   t        j                  |       sy| dk(  ryt        j                  t        |             t        j                  |      z  }|)t        j                  |t        j
                  |            S t        j                  |t        j
                  |      |      S )z1Return True if *x* is an integer power of *base*.Frh  Tr  )r   isfiniter[  r   iscloser  )rZ   rP  r  lxs       r-   r  r    sq    ;;q>Cx	A"&&,	&B|zz"bhhrl++zz"bhhrl66r/   c                     | dk(  r| S | dk  rt        |  |       S |t        j                  t        j                  |       t        j                  |      z        z  S )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   r  r[  rZ   rP  s     r-   _decade_less_equalr    sX     aA 801A"A2t,,8BHHRVVAY5668r/   c                     | dk(  r| S | dk  rt        |  |       S |t        j                  t        j                  |       t        j                  |      z        z  S )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   r-  r[  r  s     r-   r  r    sX     aA 7-.UD))7BGGBFF1It4557r/   c                 X    | dk  rt        |  |       S t        | |      }|| k(  r||z  }|S )z
    Return the largest integer power of *base* that's less than *x*.

    If *x* is negative, the exponent will be *greater*.
    r   )_decade_greaterr  )rZ   rP  lesss      r-   _decade_lessr    s>     	1uD)))a&DqyKr/   c                 X    | dk  rt        |  |       S t        | |      }|| k(  r||z  }|S )z
    Return the smallest integer power of *base* that's greater than *x*.

    If *x* is negative, the exponent will be *smaller*.
    r   )r  r  )rZ   rP  greaters      r-   r  r  	  s>     	1uaR&&&#At,G!|4Nr/   c                 @    t        j                  | t        |             S r1   )r  r  r  rZ   s    r-   rm  rm  	  s    <<58$$r/   c                   J    e Zd ZdZddddZddddZd Zd Zd Zd	 Z	d
 Z
y)r   zd
    Place logarithmically spaced ticks.

    Places ticks at the values ``subs[j] * base**i``.
    N)r>  c                    |t         j                  d   rd}nd}t        |      | _        | j	                  |       || _        y)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.
        NrI  r  r  )rt   ru   r+  rT  	_set_subsr>  r+   rP  subsr>  s       r-   r.   zLogLocator.__init__	  s?    , ||45!4[
t r/   c                b    |t        |      | _        || j                  |       ||| _        yyr/  )r+  rT  r  r>  r  s       r-   r  zLogLocator.set_params>	  s7    tDJNN4 $DM  r/   c                 r   |d| _         yt        |t              rt        j                  d|       || _         y	 t        j                  |t              | _         | j                   j                  dk7  r#t        d	| j                   j                   d
      y# t        $ r}t        d| d      |d}~ww xY w)zT
        Set the minor ticks for the log scaling every ``base**i*subs[j]``.
        Nr  )r  r  )r  )dtypez>subs must be None, 'all', 'auto' or a sequence of floats, not ry  r'   z5A sequence passed to subs must be 1-dimensional, not z-dimensional.)
_subsr   r   r   r  r   r)  r+  r   ndim)r+   r  r  s      r-   r  zLogLocator._set_subsG	  s     <DJc"T:DJ4ZZE:

 zz!#  "7$(JJOO#4M"C D D $	  4  ">$(6", -2344s    B 	B6!B11B6c                 `    | j                   j                         \  }}| j                  ||      S rH  rI  r7   s      r-   r\   zLogLocator.__call__\	  r&  r/   c                    | j                   dk(  r?| j                  0t        j                  | j                  j	                         dd      }nd}n| j                   }| j
                  }|dk  rK| j                  | j                  j                         }|dk  st        j                  |      st        d      t        j                  d||       ||k  r||}}t        j                  |      t        j                  |      z  }t        j                  |      t        j                  |      z  }t        j                  |      t        j                  |      z
  }t        | j                   t"              ro|dkD  s|dk  r;| j                   dk(  rt        j$                  g       S t        j$                  d	g      }n6| j                   dk(  rd
nd	}	t        j&                  |	|      }n| j                   }t(        j*                  d   r%t-        t        j                  ||dz
  z        d      n||z  dz   }
|
|k\  rt-        d|dz
        }
t/        |      dkD  xs t/        |      dk(  xr |d   d	k7  }t        j&                  t        j                  |      |
z
  t        j                  |      d|
z  z   |
      }|rE|
dk(  r*t        j0                  ||z  D cg c]  }||z  	 c}      }nt        j$                  g       }n||z  }t        j                  d|       t/        |      dkD  r;|
dk(  r6||k  ||k  z  j3                         dk  rt5               j7                  ||      S | j9                  |      S c c}w )Nr  r   rE   rh  @Data has no positive values, and therefore cannot be log-scaled.zvmin %s vmax %sr  r:  r`  r  rI  r'   r   zticklocs %r)r>  rN   r   r  rG   rT  r=   r  r   r  debugr  r[  r  r-  r   r  r   r  r^  rt   ru   r  r   r  r  r   r  r  )r+   r8   r9   r>  r   log_vminlog_vmaxr_  r  _firststride	have_subsdecadesdecade_startrL  s                  r-   r  zLogLocator.tick_valuesa	  s   ==F"yy$77499#;#;#=q!D}}HJJ3;yy$yy++-s{"++d"3 VX X 	

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

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

=(+IMaKh&8t+;<AACqH =,,T488((22 Ks   M+c                     | j                   }| j                  ||      \  }}t        j                  d   dk(  rt	        ||      }t        ||      }||fS rN  rO  rP  )rT  ro  rt   ru   r  r  r+   r8   r9   r   s       r-   r  zLogLocator.view_limits	  sU    JJ%%dD1
d<<-./A%dA.D(q1DTzr/   c                    ||kD  r||}}t        j                  |      rt        j                  |      s	d\  }}||fS |dk  rt        j                  d       d\  }}||fS t	        d | j
                  j                         D              }t        j                  |      sd}|dk  r|}||k(  r,t        || j                        }t        || j                        }||fS )N)r'   r  r   r  c              3   <   K   | ]  }|j                           y wr1   )r=   )r   rN   s     r-   r   z)LogLocator.nonsingular.<locals>.<genexpr>	  s     T7St*7Ss   gYn)
r   r  r   r   r*  rN   _get_shared_axisr  rT  r  )r+   r8   r9   r,   s       r-   ro  zLogLocator.nonsingular	  s    $;t$D{{4 D(9JD$  Tz QY JD$ Tz Ttyy7Q7Q7STTF;;v&qyt|#D$**5&tTZZ8Tzr/   )r   )r`  r(  )rI   rJ   rK   r|   r.   r  r  r\   r  r  ro  rF   r/   r-   r   r   	  s;    !4 !>%4 %D*,
L3\
r/   r   c                   2    e Zd ZdZddZd	dZd Zd Zd Zy)
r    z^
    Place ticks spaced linearly near zero and spaced logarithmically beyond a threshold.
    Nc                     |#|j                   | _        |j                  | _        n|||| _        || _        nt	        d      |dg| _        d| _        y|| _        d| _        y)a  
        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  )rP  rT  rR  rO  r   r  r>  )r+   r  r  rR  rP  s        r-   r.   zSymmetricalLogLocator.__init__	  st    &  "DJ'11DO"t'7DJ'DO ; < <<DJ  DJr/   c                 *    ||| _         ||| _        yyr/  )r>  r  )r+   r  r>  s      r-   r  z SymmetricalLogLocator.set_params	  s!    $DMDJ r/   c                 `    | j                   j                         \  }}| j                  ||      S rH  rI  r7   s      r-   r\   zSymmetricalLogLocator.__call__ 
  s-     YY002
dd++r/   c           	         | j                   }||k  r||}}| |cxk  r|cxk  r|k  rn nt        |d|h      S || k  }||kD  }|xr || kD  xs	 |xr ||k  }| j                  fd}d\  }}	|r.t        | |      }
 |t	        |
      t	        |      dz         \  }}	d\  }}|rt        ||      } |||dz         \  }}|	|z
  ||z
  z   }|r|dz  }t        || j                  dz
  z  d      }g }|r2|j                  dt        j                  ||	|      d d d   z  z         |r|j                  d       |r)|j                  t        j                  |||      z         t        j                  | j                        }t        |      dkD  s|d   dk7  r5g }|D ]-  }|dk(  r|j                  |       |j                  ||z         / n|}| j                  t        j                  |            S )Nr   c                    t        j                  t        j                  |       t        j                        z        } t        j                  t        j                  |      t        j                        z        }| |fS r1   )r   r  r[  r-  )lohirP  s     r-   get_log_rangez8SymmetricalLogLocator.tick_values.<locals>.get_log_range-
  sR    "&&*rvvd|34BbffTl23Br6Mr/   rJ  r'   r   rh  r`  )rO  r(  rT  r*  r   r  r>  extendr   r^  appendr)  r  r   r  r  )r+   r8   r9   rR  has_ahas_chas_br  a_loa_hia_upper_limc_loc_hic_lower_limtotal_ticksr  r  r  rL  decaderP  s                       @r-   r  z!SymmetricalLogLocator.tick_values
  s   OO	$;t$D* :11	14D/** 
"	! ,49*,M%2LD9<Lzz	 
dyj$/K&s;'7TQGJD$
di.K&{D1H=JD$ d{td{31K[T]]Q%67;NN2"))D$4:+<<@bD+B "C D E NN3NN4BIIdD&$ABCzz$**%t9q=DGsNH!Q;OOF+OOD6M2	 " H$$RXXh%788r/   c                     | j                   }||k  r||}}t        j                  d   dk(  r5t        ||      }t	        ||      }||k(  rt        ||      }t        ||      }t        j                  ||      S r  )	rT  rt   ru   r  r  r  r  rn  ro  r  s       r-   r  z!SymmetricalLogLocator.view_limits\
  sw    JJ$;t$D<<-./A%dA.D(q1Dt|#D!,&tQ/&&tT22r/   NNNNr(  ra  rF   r/   r-   r    r    	  s#     D,T9l3r/   r    c                   @     e Zd ZdZ	 	 d fd	Z	 	 ddZd Zd Z xZS )r!   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                 h    t         |           || _        || _        || _        || _        || _        y)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>  	symthreshrP  r  )r+   r  r>  r  rP  r  r   s         r-   r.   zAsinhLocator.__init__w
  s4    0 	( "		r/   c                 n    ||| _         ||| _        ||| _        |t        |      dkD  r|nd| _        yy)r0  Nr   )r>  r  rP  r   r  )r+   r>  r  rP  r  s        r-   r  zAsinhLocator.set_params
  sI     $DM &DNDI #D	A4DI r/   c                    | j                   j                         \  }}||z  dk  rOt        d||z  z         | j                  k  r1t	        t        |      t        |            }| j                  | |      S | j                  ||      S r7  )rN   r4   r   r  r  r  )r+   r8   r9   bounds       r-   r\   zAsinhLocator.__call__
  sx    YY002
d4K1Q_!5!FD	3t9-E##UFE22##D$//r/   c                    | j                   t        j                  t        j                  ||g      | j                   z        z  \  }}t        j                  ||| j
                        }t        |||z
  z        }||z  dk  r*t        j                  ||d| j
                  z  kD     dg      }| j                   t        j                  || j                   z        z  }|dk(  }t        j                  d      5  | j                  dkD  rt        j                  |      | j                  t        j                  t        j                  t        |            t        j                  | j                        z        z  z  }	| j                  r.t        j                   |	| j                        j#                         n|	}
ndt        j$                  |ddt        j                  t        j&                  t        |                  z        }	|	t        j(                  ||	z        z  }
d d d        t        j                  t+        t-        
                  }t/        |      dk\  r|S t        j                  ||| j
                        S # 1 sw Y   axY w)	Nr   r  rh  ignore)divider'   r  r   )r  r   arcsinhr  rK  r>  r   hstacksinherrstaterP  r3  r  r[  r  r  outerflattenwherer  r  r(  r]  r   )r+   r8   r9   yminymaxyszero_devxszero_xspowsqsr7  s               r-   r  zAsinhLocator.tick_values
  s   &&BHHdD\4J6:6G6G5H *I I
d[[tT]]3rTD[)*$;?B3+> >@#FGB d.?.?)?!@@7 [[)yy1}))rxxs2w$((499BU0U'VVW<@IIRXXdDII.6684xxB#b'9J0K,KLBHHR$Y// * B)E
auSR[[tT]]-SS *)s   6D%I;;J)rB  g?r  Nr  )	rI   rJ   rK   r|   r.   r  r\   r  r   r   s   @r-   r!   r!   l
  s.    	 =@#> 37#'
80Tr/   r!   c                   z     e Zd ZdZd
dd fdZd fd	Zed        Zej                  d        Z fdZ	d	 Z
 xZS )r"   z5
    Place ticks spaced evenly on a logit scale.
    r  r1  c                :    || _         t        | 	  |g d       y)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  r  r-  rt  N)r  r   r.   )r+   r  r-  r   s      r-   r.   zLogitLocator.__init__
  s     uM:r/   c                 6    ||| _         t        |   di | y)r0  NrF   )r  r   r  )r+   r  rR   r   s      r-   r  zLogitLocator.set_params
  s     DK$V$r/   c                     | j                   S r1   )r  r3   s    r-   r  zLogitLocator.minor
  s    {{r/   c                 (    | j                  |       y )N)r  )r  re   s     r-   r  zLogitLocator.minor
  s    e$r/   c                 N   t        | j                  d      r.| j                  j                  j                  dk(  rt	        d      | j
                  dk(  r1| j                  "| j                  j                         }|dk  rd}nd}n| j
                  }d }| j                  ||      \  }}t        |dk  r(t        j                  t        j                  |            n2|d	k  rd
n+t        j                  t        j                  d|z
                     }t        |dk  r(t        j                  t        j                  |            n2|d	k  rdn+t        j                  t        j                  d|z
                     }||z
  dz
  }|dk\  r||kD  rt        j                  ||z        }| j                  r+t        ||dz         D 	cg c]  }	|	|z  d
k7  r ||	       }
}	n*t        ||dz         D 	cg c]  }	|	|z  d
k(  r ||	       }
}	| j!                  t        j"                  |
            S | j                  rg }
t        ||      D ]  }	|	dk  r,|
j%                  t        j&                  dd      d|	z  z         4|	dk(  r)|
j%                  t        j&                  dd      dz         b|	d
k(  r)|
j%                  t        j&                  dd      dz         |
j%                  dt        j&                  dd      d d d   d|	 dz
  z  z  z
          | j!                  t        j"                  |
            S t        ||dz         D 	cg c]
  }	 ||	       }
}	| j!                  t        j"                  |
            S | j                  rg S t(        | U  ||      S c c}	w c c}	w c c}	w )Nr   polarz%Polar axis cannot be logit scaled yetr  r   rE   c                 6    | dk  rd| z  S | dkD  r	dd|  z  z
  S dS )Nr   r  r'   r  rF   r  s    r-   ideal_ticksz-LogitLocator.tick_values.<locals>.ideal_ticks
  s-    !e27KQUbaRj)9KKr/   r  r  r   r'   r   r  r  r  )r  rN   r   r  rX   r  rG   ro  r@  r   r  r  r-  r  r  r  r  r  r  r^  r   r  )r+   r8   r9   r-  r  binfbsupnumidealsubsampling_factorr   rL  r   s              r-   r  zLogitLocator.tick_values
  sS   499f%$))..*=*=*H%&MNN;;& yy$		00219EKKE
	L %%dD1
dcz HHRXXd^$ cz ''"((1t8,--
 s{ GGBHHTN# s{ ((288AH-..
 $;?q=% &*YYx%/?%@";; "'tTAX!6 !6A 22q8 $A!6    "'tTAX!6 !6A 22q8 $A!6   
 ,,RXXh-?@@{{tT*A2v 		!R(827(BCb 		!Q"(<=a 		!Q"(<= 		!R 02 6Q GG + ,,RXXh-?@@05dD1H0EF0E1A0EHF((();<<;;Iw"4..?  ( Gs   N/NN"c                    d}|d|z
  f}||kD  r||}}t        j                  |      rt        j                  |      s	|\  }}||fS |dk  s|dk\  rt        j                  d       |\  }}||fS | j                  | j                  j                         n|}t        j                  |      s|}|dk  r|}|dk\  rd|z
  }||k(  rd|z  dd|z  z
  }}||fS )Nr  r'   r   zIData has no values between 0 and 1, and therefore cannot be logit-scaled.r  )r   r  r   r   rN   r=   )r+   r8   r9   standard_minposinitial_ranger,   s         r-   ro  zLogitLocator.nonsingular5  s
   (!o*=>$;t$D{{4 D(9&JD$8 Tz7 QY$!)   'JD$( Tz! 99( 		$$&$ 
 ;;v&(qy
 qy6zt| 4ZS4ZdTzr/   )Fr1   )rI   rJ   rK   r|   r.   r  rF  r  r	  r  ro  r   r   s   @r-   r"   r"   
  sQ    ;V ;%   \\% %K/Z"r/   r"   c                   "     e Zd ZdZ fdZ xZS )r   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                 h    t         j                  d   rd}g d}nd}g d}t        |   ||       y)z
        To know the values of the non-public parameters, please have a
        look to the defaults of `~matplotlib.ticker.MaxNLocator`.
        rI  rE   r  r  )r'   r   r  r  r  r  N)rt   ru   r   r.   )r+   r-  rt  r   s      r-   r.   zAutoLocator.__init__b  s8    
 <<01E!EE&EuE2r/   )rI   rJ   rK   r|   r.   r   r   s   @r-   r   r   Z  s    3 3r/   r   c                   $    e Zd ZdZddZd Zd Zy)r   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                     || _         y)aG  
        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+   r5  s     r-   r.   zAutoMinorLocator.__init__x  s     
r/   c                 >   | j                   j                         dk(  rt        j                  d       g S t	        j
                  | j                   j                               }t        |      dk  rg S |d   |d   z
  }| j                  3t        j                  | j                   j                  dk(  rdnd   | _        | j                  d	k(  rFd
t	        j                  |      dz  z  }t	        j                  |g d      j                         rdnd}n| j                  }||z  }t        | j                   j!                               \  }}|d   }t#        ||z
  |z        }	t#        ||z
  |z        dz   }
t	        j$                  |	|
      |z  |z   }| j'                  |      S )Nr[  z4AutoMinorLocator does not work on logarithmic scalesr   r'   r   r  zytick.minor.ndivszxtick.minor.ndivsr  r  )r'   r  r  r  r  r  )rN   	get_scaler   r   r   uniqueget_majorticklocsr   r"  rt   ru   	axis_namer  r  r}  r(  r4   r  r^  r  )r+   	majorlocs	majorstepmajorstep_mantissar"  	minorstepr8   r9   t0tmintmaxrp   s               r-   r\   zAutoMinorLocator.__call__  sp   99 E)UVIIIdii99;<	y>A IaL9Q</	::'+yy':':c'A#(*DJ ::!#(;a(?!@$6HLLNATUEJJE%	DII779:
dq\dRi9,-dRi9,-1		$%	1R7$$T**r/   c                 D    t        dt        |       j                         )Nz Cannot get tick locations for a )rX   r  rI   r7   s      r-   r  zAutoMinorLocator.tick_values  s&    !.tDz/B/B.CDF 	Fr/   r1   )rI   rJ   rK   r|   r.   r\   r  rF   r/   r-   r   r   p  s    !+FFr/   r   )r'   r  ):r|   r/  loggingr   r  numbersr   stringnumpyr   r   rt   r   r   r   rn  	getLoggerrI   r  __all__r$   r   r   r
   r	   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rf  rW  r   r  r  r  r  r  rm  r   r    r!   r"   r   r   rF   r/   r-   <module>r6     s  BH         " 0w"	D 8- -=
 =@I !Y !D!I !8 0	M&** 	MD D8C>i C>L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r/   