
 m[c           @` s@  d  Z  d d l m Z m Z m Z m Z d d l 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 m Z d d l m Z d d l m Z d d l Z 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# f Z e j re Z n  d$   Z d%   Z d& e f d'     YZ d( e f d)     YZ d* e f d+     YZ d, e f d-     YZ d. e f d/     YZ d0 e f d1     YZ  d2 e f d3     YZ! d4 e f d5     YZ" d6 e f d7     YZ# d8 e f d9     YZ$ d: e f d;     YZ% d< e f d=     YZ& d> e& f d?     YZ' d@ e& f dA     YZ( dB e( f dC     YZ) dD e f dE     YZ* dF e f dG     YZ+ dH e f dI     YZ, dJ e f dK     YZ- dL e- f dM     YZ. dN e- f dO     YZ/ dP e- f dQ     YZ0 dR e- f dS     YZ1 dT   Z2 dU e f dV     YZ3 dW e- f dX     YZ4 dY dZ d[  Z5 d\ e- f d]     YZ6 d^ d_  Z7 d^ d`  Z8 da   Z9 d^ db  Z: dc   Z; dd e- f de     YZ< df e- f dg     YZ= dh e- f di     YZ> dj e6 f dk     YZ? dl e- f dm     YZ@ dn e- f do     YZA d S(p   u  
Tick locating and formatting
============================

This module contains classes to support completely configurable tick
locating and formatting. 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. Generic tick locators and
formatters are provided, as well as domain specific custom ones.

Default Formatter
-----------------

The default formatter identifies when the x-data being plotted is a
small range on top of a large off set. To reduce the chances that the
ticklabels overlap the ticks are labeled as deltas from a fixed offset.
For example::

   ax.plot(np.arange(2000, 2010), range(10))

will have tick of 0-9 with an offset of +2e3. If this is not desired
turn off the use of the offset on the default formatter::

   ax.get_xaxis().get_major_formatter().set_useOffset(False)

set the rcParam ``axes.formatter.useoffset=False`` to turn it off
globally, or set a different formatter.

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

:class:`AutoLocator`
    `MaxNLocator` with simple defaults.  This is the default tick locator for
    most plotting.

:class:`MaxNLocator`
    Finds up to a max number of intervals with ticks at nice locations.

:class:`LinearLocator`
    Space ticks evenly from min to max.

:class:`LogLocator`
    Space ticks logarithmically from min to max.

:class:`MultipleLocator`
    Ticks and range are a multiple of base; either integer or float.

:class:`FixedLocator`
    Tick locations are fixed.

:class:`IndexLocator`
    Locator for index plots (e.g., where ``x = range(len(y))``).

:class:`NullLocator`
    No ticks.

:class:`SymmetricalLogLocator`
    Locator for use with with the symlog norm; works like `LogLocator` for the
    part outside of the threshold and adds 0 if inside the limits.

:class:`LogitLocator`
    Locator for logit scaling.

:class:`OldAutoLocator`
    Choose a `MultipleLocator` and dynamically reassign it for intelligent
    ticking during navigation.

:class:`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 `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.

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.

:class:`NullFormatter`
    No labels on the ticks.

:class:`IndexFormatter`
    Set the strings from a list of labels.

:class:`FixedFormatter`
    Set the strings manually for the labels.

:class:`FuncFormatter`
    User defined function sets the labels.

:class:`StrMethodFormatter`
    Use string `format` method.

:class:`FormatStrFormatter`
    Use an old-style sprintf format string.

:class:`ScalarFormatter`
    Default formatter for scalars: autopick the format string.

:class:`LogFormatter`
    Formatter for log axes.

:class:`LogFormatterExponent`
    Format values for log axis using ``exponent = log_base(value)``.

:class:`LogFormatterMathtext`
    Format values for log axis using ``exponent = log_base(value)``
    using Math text.

:class:`LogFormatterSciNotation`
    Format values for log axis using scientific notation.

:class:`LogitFormatter`
    Probability formatter.

:class:`EngFormatter`
    Format labels in engineering notation

:class:`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)

See :doc:`/gallery/ticks_and_spines/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.
i    (   t   absolute_importt   divisiont   print_functiont   unicode_literalsN(   t   rcParams(   t   cbook(   t
   transforms(   t   mplDeprecationu
   TickHelperu	   Formatteru   FixedFormatteru   NullFormatteru   FuncFormatteru   FormatStrFormatteru   StrMethodFormatteru   ScalarFormatteru   LogFormatteru   LogFormatterExponentu   LogFormatterMathtextu   IndexFormatteru   LogFormatterSciNotationu   LogitFormatteru   EngFormatteru   PercentFormatteru   Locatoru   IndexLocatoru   FixedLocatoru   NullLocatoru   LinearLocatoru
   LogLocatoru   AutoLocatoru   MultipleLocatoru   MaxNLocatoru   AutoMinorLocatoru   SymmetricalLogLocatoru   LogitLocatorc         C` sX   t  |  t j  r! |  j   }  n  t  | t j  rB | j   } n  t j j j |  |  S(   N(   t
   isinstancet   npt   generict   itemt   sixt   movest   builtinst   divmod(   t   xt   y(    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt   _divmod   s
    c         C` s   d |  S(   Nu   \mathdefault{%s}(    (   t   s(    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt   _mathdefault   s    t
   _DummyAxisc           B` sJ   e  Z d  d  Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   i    c         C` s1   t  j j   |  _ t  j j   |  _ | |  _ d  S(   N(   t   mtransformst   Bboxt   unitt   dataLimt   viewLimt   _minpos(   t   selft   minpos(    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt   __init__   s    c         C` s
   |  j  j S(   N(   R   t	   intervalx(   R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt   get_view_interval   s    c         C` s   | | f |  j  _ d  S(   N(   R   R   (   R   t   vmint   vmax(    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt   set_view_interval   s    c         C` s   |  j  S(   N(   R   (   R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt
   get_minpos   s    c         C` s
   |  j  j S(   N(   R   R   (   R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt   get_data_interval   s    c         C` s   | | f |  j  _ d  S(   N(   R   R   (   R   R!   R"   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt   set_data_interval   s    c         C` s   d S(   Ni	   (    (   R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt   get_tick_space   s    (	   t   __name__t
   __module__R   R    R#   R$   R%   R&   R'   (    (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR      s   					t
   TickHelperc           B` s;   e  Z d Z d    Z d   Z d   Z d   Z d   Z RS(   c         C` s   | |  _  d  S(   N(   t   axis(   R   R+   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt   set_axis   s    c         K` s%   |  j  d  k r! t |   |  _  n  d  S(   N(   R+   t   NoneR   (   R   t   kwargs(    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt   create_dummy_axis   s    c         C` s   |  j  j | |  d  S(   N(   R+   R#   (   R   R!   R"   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR#      s    c         C` s   |  j  j | |  d  S(   N(   R+   R&   (   R   R!   R"   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR&      s    c         C` s$   |  j  | |  |  j | |  d  S(   N(   R#   R&   (   R   R!   R"   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt
   set_bounds   s    N(	   R(   R)   R-   R+   R,   R/   R#   R&   R0   (    (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR*      s   				t	   Formatterc           B` sM   e  Z d  Z g  Z d d  Z d   Z d   Z d   Z d   Z	 d   Z
 RS(   u=   
    Create a string based on a tick value and location.
    c         C` s   t  d   d S(   u   
        Return the format for tick value *x* at position pos.
        ``pos=None`` indicates an unspecified location.
        u   Derived must overrideN(   t   NotImplementedError(   R   R   t   pos(    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt   __call__  s    c         C` s   |  j  |  S(   ul   
        Returns the full string representation of the value with the
        position unspecified.
        (   R4   (   R   t   value(    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt   format_data  s    c         C` s   |  j  |  S(   u|   
        Return a short string version of the tick value.

        Defaults to the position-independent long value.
        (   R6   (   R   R5   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt   format_data_short  s    c         C` s   d S(   Nu    (    (   R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt
   get_offset"  s    c         C` s   | |  _  d  S(   N(   t   locs(   R   R9   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt   set_locs%  s    c         C` s   | S(   u{  
        Some classes may want to replace a hyphen for minus with the
        proper unicode symbol (U+2212) for typographical correctness.
        The default is to not replace it.

        Note, if you use this method, e.g., in :meth:`format_data` or
        call, you probably don't want to use it for
        :meth:`format_data_short` since the toolbar uses this for
        interactive coord reporting and I doubt we can expect GUIs
        across platforms will handle the unicode correctly.  So for
        now the classes that override :meth:`fix_minus` should have an
        explicit :meth:`format_data_short` method
        (    (   R   R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt	   fix_minus(  s    N(   R(   R)   t   __doc__R9   R-   R4   R6   R7   R8   R:   R;   (    (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR1     s   				t   IndexFormatterc           B` s#   e  Z d  Z d   Z d d  Z RS(   uL   
    Format the position x to the nearest i-th label where i=int(x+0.5)
    c         C` s   | |  _  t |  |  _ d  S(   N(   t   labelst   lent   n(   R   R>   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR   =  s    	c         C` s>   t  | d  } | d k  s+ | |  j k r/ d S|  j | Sd S(   u   
        Return the format for tick value `x` at position pos.

        The position is ignored and the value is rounded to the nearest
        integer, which is used to look up the label.
        g      ?i    u    N(   t   intR@   R>   (   R   R   R3   t   i(    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR4   A  s    N(   R(   R)   R<   R   R-   R4   (    (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR=   9  s   	t   NullFormatterc           B` s   e  Z d  Z d d  Z RS(   u)   
    Always return the empty string.
    c         C` s   d S(   u9   
        Returns an empty string for all inputs.
        u    (    (   R   R   R3   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR4   S  s    N(   R(   R)   R<   R-   R4   (    (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyRC   O  s   t   FixedFormatterc           B` s5   e  Z d  Z d   Z d d  Z d   Z d   Z RS(   uU   
    Return fixed strings for tick labels based only on position, not
    value.
    c         C` s   | |  _  d |  _ d S(   uK   
        Set the sequence of strings that will be used for labels.
        u    N(   t   seqt   offset_string(   R   RE   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR   _  s    	c         C` s4   | d k s! | t |  j  k r% d S|  j | Sd S(   u#  
        Returns 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.
        u    N(   R-   R?   RE   (   R   R   R3   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR4   f  s    	!c         C` s   |  j  S(   N(   RF   (   R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR8   t  s    c         C` s   | |  _  d  S(   N(   RF   (   R   t   ofs(    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt   set_offset_stringw  s    N(   R(   R)   R<   R   R-   R4   R8   RH   (    (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyRD   Z  s
   		t   FuncFormatterc           B` s#   e  Z d  Z d   Z d d  Z RS(   u   
    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         C` s   | |  _  d  S(   N(   t   func(   R   RJ   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR     s    c         C` s   |  j  | |  S(   uq   
        Return the value of the user defined function.

        `x` and `pos` are passed through as-is.
        (   RJ   (   R   R   R3   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR4     s    N(   R(   R)   R<   R   R-   R4   (    (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyRI   {  s   	t   FormatStrFormatterc           B` s#   e  Z d  Z d   Z d d  Z RS(   u   
    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.
    c         C` s   | |  _  d  S(   N(   t   fmt(   R   RL   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR     s    c         C` s   |  j  | S(   uw   
        Return the formatted label string.

        Only the value `x` is formatted. The position is ignored.
        (   RL   (   R   R   R3   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR4     s    N(   R(   R)   R<   R   R-   R4   (    (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyRK     s   	t   StrMethodFormatterc           B` s#   e  Z d  Z d   Z d d  Z RS(   u   
    Use a new-style format string (as used by `str.format()`)
    to format the tick.

    The field used for the value must be labeled `x` and the field used
    for the position must be labeled `pos`.
    c         C` s   | |  _  d  S(   N(   RL   (   R   RL   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR     s    c         C` s   |  j  j d | d |  S(   u   
        Return the formatted label string.

        `x` and `pos` are passed to `str.format` as keyword arguments
        with those exact names.
        R   R3   (   RL   t   format(   R   R   R3   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR4     s    N(   R(   R)   R<   R   R-   R4   (    (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyRM     s   	t   OldScalarFormatterc           B` s#   e  Z d  Z d d  Z d   Z RS(   u.   
    Tick location is a plain old number.
    c         C` s5   |  j  j   \ } } t | |  } |  j | |  S(   u   
        Return the format for tick val `x` based on the width of the
        axis.

        The position `pos` is ignored.
        (   R+   R    t   abst
   pprint_val(   R   R   R3   t   xmint   xmaxt   d(    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR4     s    c   	      C` sE  t  |  d k  r, | t |  k r, d | S| d k  rA d } nZ | d k  rV d } nE | d k rk d } n0 | d	 k r d
 } n | d k r d } n d } | | } | j d  } t |  d k r)| d j d  j d  } | d d j d d  } | d d j d  } d | | | f } n | j d  j d  } | S(   uP   
        Formats the value `x` based on the size of the axis range `d`.
        g     @u   %dg{Gz?u   %1.3eg?u   %1.3fg     j@u   %1.1ei
   u   %1.1fi   u   %1.2fu   ei   i    u   0u   .u   +u    u   %se%s%s(   RP   RA   t   splitR?   t   rstript   replacet   lstrip(	   R   R   RT   RL   R   t   tupt   mantissat   signt   exponent(    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyRQ     s,    $					
N(   R(   R)   R<   R-   R4   RQ   (    (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyRO     s   t   ScalarFormatterc           B` s  e  Z d  Z d d d d  Z d   Z d   Z e d e d e  Z d   Z	 d   Z
 e d e	 d e
  Z d   Z d	   Z e d e d e  Z d
   Z d d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   u   
    Format tick values as a number.

    Tick value is interpreted as a plain old number. If
    ``useOffset==True`` and the data range is much smaller than the data
    average, then an offset will be determined such that the tick labels
    are meaningful. Scientific notation is used for ``data < 10^-n`` or
    ``data >= 10^m``, where ``n`` and ``m`` are the power limits set
    using ``set_powerlimits((n,m))``. The defaults for these are
    controlled by the ``axes.formatter.limits`` rc parameter.
    c         C` s   | d  k r t d } n  t d |  _ |  j |  t d |  _ | d  k rY t d } n  |  j |  d |  _ d |  _ t |  _	 t d |  _
 | d  k r t d } n  | |  _ d  S(	   Nu   axes.formatter.useoffsetu   axes.formatter.offset_thresholdu   text.usetexu   axes.formatter.use_mathtexti    u    u   axes.formatter.limitsu   axes.formatter.use_locale(   R-   R   t   _offset_thresholdt   set_useOffsett   _usetext   set_useMathTextt   orderOfMagnitudeRN   t   Truet   _scientifict   _powerlimitst
   _useLocale(   R   t	   useOffsett   useMathTextt	   useLocale(    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR     s    			c         C` s   |  j  S(   N(   t
   _useOffset(   R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt   get_useOffset
  s    c         C` s=   | t  t g k r' d |  _ | |  _ n t |  _ | |  _ d  S(   Ni    (   Rc   t   Falset   offsetRj   (   R   t   val(    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR_     s
    		t   fgett   fsetc         C` s   |  j  S(   N(   Rf   (   R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt   get_useLocale  s    c         C` s)   | d  k r t d |  _ n	 | |  _ d  S(   Nu   axes.formatter.use_locale(   R-   R   Rf   (   R   Rn   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt   set_useLocale  s    c         C` s   |  j  S(   N(   t   _useMathText(   R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt   get_useMathText"  s    c         C` s)   | d  k r t d |  _ n	 | |  _ d  S(   Nu   axes.formatter.use_mathtext(   R-   R   Rs   (   R   Rn   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyRa   %  s    c         C` s-   t  d s t  d r | S| j d d  Sd S(   u7   
        Replace hyphens with a unicode minus.
        u   text.usetexu   axes.unicode_minusu   -u   −N(   R   RW   (   R   R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR;   -  s    c         C` s9   t  |  j  d k r d S|  j |  } |  j |  Sd S(   uI   
        Return the format for tick value `x` at position `pos`.
        i    u    N(   R?   R9   RQ   R;   (   R   R   R3   R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR4   6  s    c         C` s   t  |  |  _ d S(   uj   
        Turn scientific notation on or off.

        .. seealso:: Method :meth:`set_powerlimits`
        N(   t   boolRd   (   R   t   b(    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt   set_scientific@  s    c         C` s.   t  |  d k r! t d   n  | |  _ d S(   uW  
        Sets size thresholds for scientific notation.

        Parameters
        ----------
        lims : (min_exp, max_exp)
            A tuple containing the powers of 10 that determine the switchover
            threshold. Numbers below ``10**min_exp`` and above ``10**max_exp``
            will be displayed in scientific notation.

            For example, ``formatter.set_powerlimits((-3, 4))`` sets the
            pre-2007 default in which scientific notation is used for
            numbers less than 1e-3 or greater than 1e4.

        .. seealso:: Method :meth:`set_scientific`
        i   u%   'lims' must be a sequence of length 2N(   R?   t
   ValueErrorRe   (   R   t   lims(    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt   set_powerlimitsH  s    c         C` s(   |  j  r t j d | f  Sd | Sd S(   uM   
        Return a short formatted string representation of a number.
        u   %-12gN(   Rf   t   localet   format_string(   R   R5   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR7   ]  s    	c         C` sG   |  j  r! t j d | f  } n
 d | } |  j |  } |  j |  S(   uG   
        Return a formatted string representation of a number.
        u   %1.10e(   Rf   R{   R|   t   _formatSciNotationR;   (   R   R5   R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR6   f  s
    	
c         C` sl  t  |  j  d k r d Sd } |  j s1 |  j r_d } d } |  j rw |  j |  j  } |  j d k rw d | } qw n  |  j r |  j s |  j r |  j d |  j  } q d |  j } n  |  j r| d k r d t |  } n  d j d | t |  d f  } q_|  j rG| d k r)d | } n  d j d | | d f  } q_d j | | f  } n  |  j	 |  S(   u:   
        Return scientific notation, plus offset.
        i    u    u   +i
   u   1e%du   \times%su   $(
   R?   R9   Rb   Rm   R6   R`   Rs   R   t   joinR;   (   R   R   t	   offsetStrt	   sciNotStr(    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR8   q  s0    			$	c         C` s}   | |  _  t |  j   d k ry |  j j   \ } } t | |  } |  j rY |  j   n  |  j |  |  j | |  n  d S(   u1   
        Set the locations of the ticks.
        i    N(	   R9   R?   R+   R    RP   Rj   t   _compute_offsett   _set_orderOfMagnitudet   _set_format(   R   R9   R!   R"   RT   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR:     s    		c   
      ` s  |  j  } | d  k s" t |  r/ d |  _ d  St |  j j    \ } } t j |  } | | | k | | k @} t |  s d |  _ d  S| j	   | j
   } } | | k s | d k o | k n r d |  _ d  St t t |   t t |   g  \    t j d |  } t j t j     } d t    f d   t j | d  D  }    d | d k rd t    f d   t j | d  D  } n  |  j d }	   d | d |	 k r|   d | d | n d |  _ d  S(   Ni    i   c         3` s1   |  ]' }  d  |   d  | k r | Vq d S(   i
   N(    (   t   .0t   oom(   t   abs_maxt   abs_min(    s0   lib/python2.7/site-packages/matplotlib/ticker.pys	   <genexpr>  s    ii
   g{Gz?c         3` s5   |  ]+ }   d  |  d  | d k r | Vq d S(   i
   i   N(    (   R   R   (   R   R   (    s0   lib/python2.7/site-packages/matplotlib/ticker.pys	   <genexpr>  s    (   R9   R-   R?   Rm   t   sortedR+   R    R	   t   asarrayt   mint   maxRP   t   floatt   matht   copysignt   ceilt   log10t   nextt	   itertoolst   countR^   (
   R   R9   R!   R"   t   lmint   lmaxR[   t   oom_maxR   R@   (    (   R   R   s0   lib/python2.7/site-packages/matplotlib/ticker.pyR     s.    			(	0/22c         C` s   |  j  s d |  _ d  St j |  j  } |  j rL t j t j |   } nX | d | d k rm | d } n
 | d } | d k r d } n t j t j |   } | |  j	 d k r | |  _ n( | |  j	 d k r | |  _ n	 d |  _ d  S(   Ni    ii   (
   Rd   Rb   R	   RP   R9   Rm   R   t   floorR   Re   (   R   t   rangeR9   R   Rn   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR     s"    			
	c   	      C` s  t  |  j  d k  r1 t |  j  | | g } n	 |  j } t j |  |  j d |  j } t j |  } | d k r t j t j	 |   } n  | d k r d } n  t  |  j  d k  r | d  } n  t
 t j t j |    } t d d |  } d d | } xL | d k rUt j	 | t j | d	 |  j   | k  rQ| d 8} q
Pq
W| d 7} d
 t |  d |  _ |  j rd |  j |  _ n" |  j rd t |  j  |  _ n  d  S(   Ni   g      $@i    i   ii   gMbP?i
   t   decimalsu   %1.u   fu   $%s$(   R?   R9   t   listR	   R   Rm   Rb   t   ptpR   RP   RA   R   R   R   t   roundt   strRN   R`   Rs   R   (	   R   R!   R"   t   _locsR9   t	   loc_ranget   loc_range_oomt   sigfigst   thresh(    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR     s0    	!	.
		c         C` sd   | |  j  d |  j } t j |  d k  r6 d } n  |  j rU t j |  j | f  S|  j | Sd  S(   Ng      $@g:0yE>i    (   Rm   Rb   R	   RP   Rf   R{   R|   RN   (   R   R   t   xp(    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyRQ     s    		c         C` sH  |  j  r, t j   d } t j   d } n d } d } | j d  } y | d j d  j |  } | d d j | d	  } | d d j d  } |  j s |  j r| d
 k r | d	 k r d	 } n  | r d | | f } n  | r | r d | | f Sd | | f Sn  d | | | f j d  } | SWn t	 k
 rC| SXd  S(   Nu   decimal_pointu   positive_signu   .u   +u   ei    u   0i   u    u   1u	   10^{%s%s}u   %s{\times}%su   %s%su   %se%s%s(
   Rf   R{   t
   localeconvRU   RV   RW   RX   Rs   R`   t
   IndexError(   R   R   t   decimal_pointt   positive_signRY   t   significandR[   R\   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR}     s,    		N(   R(   R)   R<   R-   R   Rk   R_   t   propertyRg   Rq   Rr   Ri   Rt   Ra   Rh   R;   R4   Rw   Rz   R7   R6   R8   R:   R   R   R   RQ   R}   (    (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR]     s0   								
						 		*		#		t   LogFormatterc           B` sq   e  Z d  Z d e d d d  Z d   Z d   Z d d  Z d   Z	 d d  Z
 d   Z d	   Z d
   Z RS(   u	  
    Base class for formatting ticks on a log or symlog scale.

    It may be instantiated directly, or subclassed.

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

    labelOnlyBase : bool, optional, 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), optional, 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, optional, 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)``.

    g      $@c         C` s_   t  |  |  _ | |  _ | d  k r@ t d r7 d } q@ d } n  | |  _ d  |  _ | |  _ d  S(   Nu   _internal.classic_modei    i   g?(   i    i    (   i   g?(   R   t   _baset   labelOnlyBaseR-   R   t   minor_thresholdst
   _sublabelst
   _linthresh(   R   t   baseR   R   t	   linthresh(    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR   f  s    	
				c         C` s   | |  _  d S(   u   
        Change the *base* for labeling.

        .. warning::
           Should always match the base used for :class:`LogLocator`

        N(   R   (   R   R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR   u  s    c         C` s   | |  _  d S(   u   
        Switch minor tick labeling on or off.

        Parameters
        ----------
        labelOnlyBase : bool
            If True, label ticks only at integer powers of base.

        N(   R   (   R   R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt   label_minor  s    
c   
      C` sI  t  j |  j d  r# d |  _ d S|  j } | d k re y |  j j   j } Wqe t	 k
 ra qe Xn  |  j j
   \ } } | | k r | | } } n  | d k r | d k r t d  |  _ d S|  j } | d k	 red } | | k  r t | |  } | t j | |  t j |  7} n  | | k rt | |  } | t j | |  t j |  7} qnH t j |  t j |  } t j |  t j |  } t | |  } | |  j d k rd h |  _ nv | |  j d k r&t  j d d t |  d d d | }	 t t  j |	   |  _ n t t  j d | d   |  _ d S(   u   
        Use axis view limits to control which ticks are labeled.

        The *locs* parameter is ignored in the present algorithm.

        i    Ni   i   R   (   i   (   R	   t   isinfR   R-   R   R   R+   t   get_transformR   t   AttributeErrorR    t   setR   R   R   t   logR   RP   t   logspaceRA   R   t   arange(
   R   R9   R   R!   R"   Rv   t   numdect   rhst   lhst   c(    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR:     sB    			'*)c         C` sL   | d k r d | } n/ | d k  r2 d | } n |  j  | | |  } | S(   Ni'  u   %1.0ei   (   RQ   (   R   R   R!   R"   R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt   _num_to_string  s    c         C` s  | d k r d St  |  } |  j } t j |  t j |  } t |  } | rb t j |  n t j |  } t j | | |  } |  j r | r d S|  j	 d k	 r | |  j	 k r d S|  j j   \ } }	 t j | |	 d d \ } }	 |  j | | |	  }
 |  j |
  S(   u5   
        Return the format for tick val *x*.
        g        u   0u    t   expanderg?N(   RP   R   R   R   t   is_close_to_intR	   R   R   R   R   R-   R+   R    R   t   nonsingularR   R;   (   R   R   R3   Rv   t   fxt   is_x_decadeR\   t   coeffR!   R"   R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR4     s     	$c         C` s7   |  j  } t |  _  t j |  j |   } | |  _  | S(   N(   R   Rl   R   t
   strip_mathR4   (   R   R5   Rv   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR6     s
    			c         C` s   d | S(   uM   
        Return a short formatted string representation of a number.
        u   %-12g(    (   R   R5   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR7     s    c         C` s0  t  |  d k  r, | t |  k r, d | S| d k  rA d } nZ | d k  rV d } nE | d k rk d } n0 | d	 k r d
 } n | d k r d } n d } | | } | j d  } t |  d k r| d j d  j d  } t | d  } | rd | | f } q,| } n | j d  j d  } | S(   Ng     @u   %dg{Gz?u   %1.3eg?u   %1.3fg     j@u   %1.1ei
   u   %1.1fi   u   %1.2fu   ei   i    u   0u   .u   %se%d(   RP   RA   RU   R?   RV   (   R   R   RT   RL   R   RY   RZ   R\   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyRQ     s.    $					
	N(   R(   R)   R<   Rl   R-   R   R   R   R:   R   R4   R6   R7   RQ   (    (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR   ,  s   9	
	<				t   LogFormatterExponentc           B` s   e  Z d  Z d   Z RS(   uJ   
    Format values for log axis using ``exponent = log_base(value)``.
    c         C` s   t  j |  t  j |  j  } t |  d k r> d | } nT t |  d k  r] d | } n5 t  j | |  t  j |  j  } |  j | |  } | S(   Ni'  u   %1.0gi   (   R   R   R   RP   RQ   (   R   R   R!   R"   R   R   t   fd(    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR     s    #(   R(   R)   R<   R   (    (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR     s   t   LogFormatterMathtextc           B` s#   e  Z d  Z d   Z d d  Z RS(   uJ   
    Format values for log axis using ``exponent = log_base(value)``.
    c         C` s6   | r d | | | f Sd t  d | | | f  Sd S(   u&   Return string for non-decade locationsu   $%s%s^{%.2f}$u   $%s$u   %s%s^{%.2f}N(   R   (   R   t   sign_stringR   R   t   usetex(    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt   _non_decade_format,  s    	c         C` s  t  d } t  d } | d k r; | r* d Sd t d  Sn  | d k  rM d n d } t |  } |  j } t j |  t j |  } t |  } | r t j |  n t j	 |  }	 t j | | |	  }
 | r t
 |  } n  |  j r | r d S|  j d k	 r|
 |  j k rd S| d	 d
 k r3d | } n
 d | } t j |  | k  r| rhd j | |  Sd j t d j | |    SnZ | s|  j | | | |  S| rd | | t
 |  f Sd t d | | t
 |  f  Sd S(   u_   
        Return the format for tick value *x*.

        The position *pos* is ignored.
        u   text.usetexu   axes.formatter.min_exponenti    u   $0$u   $%s$u   0u   -u    i   g        u   %du   %su
   ${0}{1:g}$u   ${0}$u   {0}{1:g}u   $%s%s^{%d}$u	   %s%s^{%d}N(   R   R   RP   R   R   R   R   R	   R   R   t   nearest_longR   R   R-   RN   R   (   R   R   R3   R   t   min_expR   Rv   R   R   R\   R   R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR4   4  sH    

	$
	N(   R(   R)   R<   R   R-   R4   (    (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR   '  s   	t   LogFormatterSciNotationc           B` s   e  Z d  Z d   Z RS(   uL   
    Format values following scientific notation in a logarithmic axis.
    c         C` s   t  |  } t j |  } | | | | } t |  rH t |  } n  | rb d | | | | f Sd t d | | | | f  Sd S(   u&   Return string for non-decade locationsu   $%s%g\times%s^{%d}$u   $%s$u   %s%g\times%s^{%d}N(   R   R   R   R   R   R   (   R   R   R   R   R   Rv   R\   R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR   r  s    	(   R(   R)   R<   R   (    (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR   m  s   t   LogitFormatterc           B` s#   e  Z d  Z d d  Z d   Z RS(   u2   
    Probability formatter (using Math text).
    c         C` s   d } d | k o d k n r4 d j  |  } n | d k  ry t |  rg d j  t j |   } q d j  |  } nB t d |  r d j  t j d |   } n d	 j  d |  } | S(
   Nu    g{Gz?gGz?u   {:.2f}u   $10^{{{:.0f}}}$u   ${:.5f}$i   u   $1-10^{{{:.0f}}}$u
   $1-{:.5f}$(   RN   t	   is_decadeR	   R   (   R   R   R3   R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR4     s    c         C` s   d | S(   u:   return a short formatted string representation of a numberu   %-12g(    (   R   R5   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR7     s    N(   R(   R)   R<   R-   R4   R7   (    (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR     s   t   EngFormatterc           B` s   e  Z d  Z i d d 6d d 6d d 6d d 6d	 d
 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d  6d! d" 6Z d d' d# d$  Z d' d%  Z d&   Z RS((   u   
    Formats axis values using engineering prefixes to represent powers
    of 1000, plus a specified unit, e.g., 10 MHz instead of 1e7.
    u   yiu   ziu   aiu   fiu   piu   niu   μiu   miu    i    u   ki   u   Mi   u   Gi	   u   Ti   u   Pi   u   Ei   u   Zi   u   Yi   u    c         C` s   | |  _  | |  _ | |  _ d S(   u  
        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``).
        N(   R   t   placest   sep(   R   R   R   R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR     s    		c         C` sg   d |  j  |  |  j f } t |  j  d k rZ | j |  j  rZ | t |  j   } n  |  j |  S(   Nu   %s%si    (   t
   format_engR   R?   R   t   endswithR;   (   R   R   R3   R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR4     s    'c   
   	   C` s  t  | t j  r% t j d t  n  t |  } d } |  j d k rL d n d j	 |  j  } | d k  rz d } | } n  | d k r t
 t j t j |  d  d  } n d } d } t j | t |  j  t |  j   } | | d	 | } t d
 j	 d | d |   } | d k rJ| t |  j  k rJ| d } | d 7} n  |  j t
 |  } d j	 d | d |  j d | d |  }	 |	 S(   u  
        Formats a number in engineering notation, appending a letter
        representing the power of 1000 of the original number.
        Some examples:

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

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

        >>> format_eng("-1e-6") # for self.places = 2
        u'-1.00 μ'

        `num` may be a numeric value or a string that can be converted
        to a numeric value with ``float(num)``.
        uk   Passing a string as *num* argument is deprecated sinceMatplotlib 2.1, and is expected to be removed in 2.3.i   u   gu   .{:d}fi    ii   g        g      $@u   {mant:{fmt}}t   mantRL   i  u   {mant:{fmt}}{sep}{prefix}R   t   prefixN(   R   R   t   string_typest   warningst   warnR   R   R   R-   RN   RA   R   R   R   R	   t   clipR   t   ENG_PREFIXESR   R   (
   R   t   numt   dnumR[   RL   t   pow10R   t   _fmantR   t	   formatted(    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR     s0    
'
)'!
	N(   R(   R)   R<   R   R-   R   R4   R   (    (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR     s,   
t   PercentFormatterc           B` sb   e  Z d  Z d d	 d e d  Z d	 d  Z d   Z d   Z e	 d    Z
 e
 j d    Z
 RS(
   u  
    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 : string 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.
    id   u   %c         C` s,   | d |  _  | |  _ | |  _ | |  _ d  S(   Ng        (   RS   R   t   _symbolt	   _is_latex(   R   RS   R   t   symbolt   is_latex(    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR   2  s    		c         C` s>   |  j  j   \ } } t | |  } |  j |  j | |   S(   uP   
        Formats the tick as a percentage with the appropriate scaling.
        (   R+   R    RP   R;   t
   format_pct(   R   R   R3   t   ax_mint   ax_maxt   display_range(    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR4   8  s    c         C` s   |  j  |  } |  j d k r |  j  |  } | d k rB d } q t j d t j d |   } | d k rw d } q | d k  r d } q n	 |  j } d j d | d t |   } | |  j S(   u  
        Formats 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.
        i    g       @i   u   {x:0.{decimals}f}R   R   N(	   t   convert_to_pctR   R-   R   R   R   RN   RA   R   (   R   R   R   t   scaled_rangeR   R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR   A  s    	 		c         C` s   d | |  j  S(   Ng      Y@(   RS   (   R   R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR   p  s    c         C` sZ   |  j  } | s d } n> t d rV |  j rV x' d D] } | j | d |  } q3 Wn  | S(   u   
        The configured percent symbol as a string.

        If LaTeX is enabled via :rc:`text.usetex`, the special characters
        ``{'#', '$', '%', '&', '~', '_', '^', '\', '{', '}'}`` are
        automatically escaped in the string.
        u    u   text.usetexu
   \#$%&~_^{}u   \(   R   R   R   RW   (   R   R   t   spec(    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR   s  s    			c         C` s   | |  _  d  S(   N(   R   (   R   R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR     s    N(   R(   R)   R<   R-   Rl   R   R4   R   R   R   R   t   setter(    (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR     s   		/	t   Locatorc           B` se   e  Z d  Z d Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z d
   Z RS(   u   
    Determine the tick locations;

    Note, you should not use the same locator between different
    :class:`~matplotlib.axis.Axis` because the locator stores references to
    the Axis data and view limits
    i  c         C` s   t  d   d S(   u  
        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 :attr:`axis` simply call
            the Locator instance::

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

        u   Derived must overrideN(   R2   (   R   R!   R"   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt   tick_values  s    c         K` s!   t  j d t t |     d S(   u   
        Do nothing, and rase a warning. Any locator class not supporting the
        set_params() function will call this.
        u/   'set_params()' not defined for locator of type N(   R   R   R   t   type(   R   R.   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt
   set_params  s    	c         C` s   t  d   d S(   u!   Return the locations of the ticksu   Derived must overrideN(   R2   (   R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR4     s    c         C` sE   t  |  |  j k rA t d j t  |  | d | d    n  | S(   uU   raise a RuntimeError if Locator attempts to create more than
           MAXTICKS locsuO   Locator attempting to generate {} ticks from {} to {}: exceeds Locator.MAXTICKSi    i(   R?   t   MAXTICKSt   RuntimeErrorRN   (   R   R9   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt   raise_if_exceeds  s    	#c         C` s   t  j | |  S(   u   
        select a scale for the range from vmin to vmax

        Normally this method is overridden by subclasses to
        change locator behaviour.
        (   R   R   (   R   R!   R"   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt   view_limits  s    c         C` s   |  j  |  j j     S(   u   autoscale the view limits(   R   R+   R    (   R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt	   autoscale  s    c         C` s   |    } t  |  } |  j j   \ } } t j | | d d \ } } | d k rs | t | d | d  } n t | |  } | | d } | | 7} | | 7} |  j j | | d t d S(	   u*   Pan numticks (can be positive or negative)R   g?i   i    i   g      @t   ignoreN(   R?   R+   R    R   R   RP   R#   Rc   (   R   t   numstepst   tickst   numticksR!   R"   t   stepRT   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt   pan  s    	

c         C` sv   |  j  j   \ } } t j | | d d \ } } t | |  } d | | } |  j  j | | | | d t d S(   u>   Zoom in/out on axis; if direction is >0 zoom in, else zoom outR   g?g?R   N(   R+   R    R   R   RP   R#   Rc   (   R   t	   directionR!   R"   t   intervalR   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt   zoom  s
    c         C` s   d S(   u1   refresh internal information based on current limN(    (   R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt   refresh  s    (   R(   R)   R<   R   R   R   R4   R   R   R   R   R   R  (    (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR     s   											t   IndexLocatorc           B` s8   e  Z d  Z d   Z d d d  Z d   Z d   Z RS(   u   
    Place a tick on every multiple of some base number of points
    plotted, e.g., on every 5th point.  It is assumed that you are doing
    index plotting; i.e., the axis is 0, len(data).  This is mainly
    useful for x ticks.
    c         C` s   | |  _  | |  _ d S(   u<   place ticks on the i-th data points where (i-offset)%base==0N(   R   Rm   (   R   R   Rm   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR     s    	c         C` s4   | d k	 r | |  _ n  | d k	 r0 | |  _ n  d S(   u"   Set parameters within this locatorN(   R-   R   Rm   (   R   R   Rm   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR     s    c         C` s%   |  j  j   \ } } |  j | |  S(   u!   Return the locations of the ticks(   R+   R%   R   (   R   t   dmint   dmax(    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR4     s    c         C` s*   |  j  t j | |  j | d |  j   S(   Ni   (   R   R	   R   Rm   R   (   R   R!   R"   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR     s    N(   R(   R)   R<   R   R-   R   R4   R   (    (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR    s
   		t   FixedLocatorc           B` s8   e  Z d  Z d d  Z d d  Z d   Z d   Z RS(   un  
    Tick locations are fixed.  If nbins is not None,
    the array of possible positions will be subsampled to
    keep the number of ticks <= nbins +1.
    The subsampling will be done so as to include the smallest
    absolute value; for example, if zero is included in the
    array of possibilities, then it is guaranteed to be one of
    the chosen ticks.
    c         C` sF   t  j |  |  _ | |  _ |  j d  k	 rB t |  j d  |  _ n  d  S(   Ni   (   R	   R   R9   t   nbinsR-   R   (   R   R9   R  (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR     s    	c         C` s   | d k	 r | |  _ n  d S(   u#   Set parameters within this locator.N(   R-   R  (   R   R  (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR     s    c         C` s   |  j  d  d   S(   N(   R   R-   (   R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR4   "  s    c         C` s   |  j  d k r |  j St t t j t |  j  |  j    d  } |  j d d |  } x` t d |  D]O } |  j | d |  } t j	 |  j
   t j	 |  j
   k  rj | } qj qj W|  j |  S(   u   "
        Return the locations of the ticks.

        .. note::

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

        i   N(   R  R-   R9   R   RA   R	   R   R?   R   RP   R   R   (   R   R!   R"   R   R   RB   t   ticks1(    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR   %  s    
.*N(   R(   R)   R<   R-   R   R   R4   R   (    (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR    s
   		t   NullLocatorc           B` s    e  Z d  Z d   Z d   Z RS(   u   
    No ticks
    c         C` s   |  j  d  d   S(   N(   R   R-   (   R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR4   ?  s    c         C` s   g  S(   u   "
        Return the locations of the ticks.

        .. note::

            Because the values are Null, vmin and vmax are not used in this
            method.
        (    (   R   R!   R"   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR   B  s    	(   R(   R)   R<   R4   R   (    (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR  :  s   	t   LinearLocatorc           B` sP   e  Z d  Z d d d  Z d d d  Z d   Z d   Z d   Z d   Z	 RS(   u  
    Determine the tick locations

    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

    c         C` s.   | |  _  | d k r! i  |  _ n	 | |  _ d S(   uX   
        Use presets to set locs based on lom.  A dict mapping vmin, vmax->locs
        N(   R   R-   t   presets(   R   R   R
  (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR   X  s    	c         C` s4   | d k	 r | |  _ n  | d k	 r0 | |  _ n  d S(   u#   Set parameters within this locator.N(   R-   R
  R   (   R   R   R
  (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR   b  s    c         C` s%   |  j  j   \ } } |  j | |  S(   u!   Return the locations of the ticks(   R+   R    R   (   R   R!   R"   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR4   i  s    c         C` s   t  j | | d d \ } } | | k  r: | | } } n  | | f |  j k r` |  j | | f S|  j d  k r| |  j   n  |  j d k r g  St j | | |  j  } |  j |  S(   NR   g?i    (	   R   R   R
  R   R-   t   _set_numticksR	   t   linspaceR   (   R   R!   R"   t   ticklocs(    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR   n  s    c         C` s   d |  _  d  S(   Ni   (   R   (   R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR    s    c         C` s   | | k  r | | } } n  | | k r? | d 8} | d 7} n  t  d d k r t t j | |  t j t |  j d d    \ } } | | d k  8} t |  j d d  | } t j | |  | } t j | |  | } n  t j	 | |  S(   u+   Try to choose the view limits intelligentlyi   u   axes.autolimit_modeu   round_numbersg      ?(
   R   R   R   R   R   R   R   R   R   R   (   R   R!   R"   R\   t	   remaindert   scale(    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR     s    
8N(
   R(   R)   R<   R-   R   R   R4   R   R  R   (    (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR	  N  s   	
			c         C` s"   t  |  |  d k  r t St Sd  S(   Ng|=(   RP   Rc   Rl   (   R   R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt   closeto  s    t   Basec           B` sD   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   uE   this solution has some hacks to deal with floating point inaccuraciesc         C` s(   | d k r t  d   n  | |  _ d  S(   Ni    u   'base' must be positive(   Rx   R   (   R   R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR     s    c         C` sX   t  | |  j  \ } } t | d  rM t | |  j d  rM | d |  j S| |  j S(   u'   return the largest multiple of base < xi    i   (   R   R   R  (   R   R   RT   t   m(    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt   lt  s    &c         C` sH   t  | |  j  \ } } t | |  j d  r= | d |  j S| |  j S(   u(   return the largest multiple of base <= xi   (   R   R   R  (   R   R   RT   R  (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt   le  s    c         C` sL   t  | |  j  \ } } t | |  j d  r= | d |  j S| d |  j S(   u(   return the smallest multiple of base > xi   i   (   R   R   R  (   R   R   RT   R  (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt   gt  s    c         C` sX   t  | |  j  \ } } t | d  rI t | |  j d  rI | |  j S| d |  j S(   u)   return the smallest multiple of base >= xi    i   (   R   R   R  (   R   R   RT   R  (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt   ge  s    &c         C` s   |  j  S(   N(   R   (   R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt   get_base  s    (	   R(   R)   R<   R   R  R  R  R  R  (    (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR    s   					t   MultipleLocatorc           B` s>   e  Z d  Z d d  Z d   Z d   Z d   Z d   Z RS(   uW   
    Set a tick on every integer that is multiple of base in the
    view interval
    g      ?c         C` s   t  |  |  _ d  S(   N(   R  R   (   R   R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR     s    c         C` s   | d k	 r | |  _ n  d S(   u#   Set parameters within this locator.N(   R-   R   (   R   R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR     s    c         C` s%   |  j  j   \ } } |  j | |  S(   u!   Return the locations of the ticks(   R+   R    R   (   R   R!   R"   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR4     s    c         C` s   | | k  r | | } } n  |  j  j |  } |  j  j   } | | d | | } | | t j | d  | } |  j |  S(   NgMbP?i   (   R   R  R  R	   R   R   (   R   R!   R"   R   R@   R9   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR     s    c         C` sv   t  d d k rZ |  j j |  } |  j j |  } | | k rf | d 8} | d 7} qf n | } | } t j | |  S(   ud   
        Set the view limits to the nearest multiples of base that
        contain the data
        u   axes.autolimit_modeu   round_numbersi   (   R   R   R  R  R   R   (   R   R  R  R!   R"   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR     s    
(   R(   R)   R<   R   R   R4   R   R   (    (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR    s   				i   id   c         C` s   t  | |   } | |  d } t  |  | | k  r= d } n) t j d t j t  |   d |  } d t j | |  d } | | f S(   Ni   i    i
   i   (   RP   R   R   R   (   R!   R"   R@   t	   thresholdt   dvt   meanvRm   R  (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt   scale_range  s    	)t   MaxNLocatorc           B` s   e  Z d  Z e d d d d d e d e d d d d  Z d	   Z e d
    Z	 e d    Z
 d   Z d   Z d   Z d   Z d   Z RS(   u<   
    Select no more than N intervals at nice locations.
    R  i
   t   stepst   integert	   symmetrict   prunet   min_n_ticksi   c         O` sY   | r8 | d | d <t  |  d k r8 t d   q8 n  |  j |  j   |  j |   d S(   u  
        Keyword args:

        *nbins*
            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*
            Sequence of nice numbers starting with 1 and ending with 10;
            e.g., [1, 2, 4, 5, 10], where the values are acceptable
            tick multiples.  i.e. for the example, 20, 40, 60 would be
            an acceptable set of ticks, as would 0.4, 0.6, 0.8, because
            they are multiples of 2.  However, 30, 60, 90 would not
            be allowed because 3 does not appear in the list of steps.

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

        *symmetric*
            If True, autoscaling will result in a range symmetric
            about zero.

        *prune*
            ['lower' | 'upper' | 'both' | None]
            Remove edge ticks -- useful for stacked or ganged plots where
            the upper tick of one axes overlaps with the lower tick of the
            axes above it, primarily when :rc:`axes.autolimit_mode` is
            ``'round_numbers'``.  If ``prune=='lower'``, the smallest tick will
            be removed.  If ``prune == 'upper'``, the largest tick will be
            removed.  If ``prune == 'both'``, the largest and smallest ticks
            will be removed.  If ``prune == None``, no ticks will be removed.

        *min_n_ticks*
            Relax `nbins` and `integer` constraints if necessary to
            obtain this minimum number of ticks.

        i    u   nbinsi   u6   Keywords are required for all arguments except 'nbins'N(   R?   Rx   R   t   default_params(   R   t   argsR.   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR     s    )c         C` s   t  j |   s t d   n  t  j |   }  t  j t  j |   d k  rZ t d   n  |  d d k sz |  d d k  r t j d  n  |  d d k r t  j d |  f  }  n  |  d d k r t  j |  d f  }  n  |  S(   Nu9   steps argument must be a sequence of numbers from 1 to 10i    u+   steps argument must be uniformly increasingii
   i   u   Steps argument should be a sequence of numbers
increasing from 1 to 10, inclusive. Behavior with
values outside this range is undefined, and will
raise a ValueError in future versions of mpl.(	   R	   t   iterableRx   R   t   anyt   diffR   R   t   hstack(   R  (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt   _validate_steps<  s     c         C` s,   d |  d  |  d |  d f } t  j |  S(   Ng?ii
   i   (   R	   R(  (   R  t   flights(    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt
   _staircaseO  s    c         K` si  d | k r@ | d |  _  |  j  d k r@ t |  j   |  _  q@ n  d | k r\ | d |  _ n  d | k r | d } | d k	 r | d k r t d   n  | |  _ n  d	 | k r t d
 | d	  |  _ n  d | k rI| d } | d k rt j	 d
 d d d d d d d d d g
  |  _
 n |  j |  |  _
 |  j |  j
  |  _ n  d | k re| d |  _ n  d S(   u#   Set parameters within this locator.u   nbinsu   autou	   symmetricu   pruneu   upperu   loweru   bothu/   prune must be 'upper', 'lower', 'both', or Noneu   min_n_ticksi   u   stepsg      ?i   g      @i   i   i   i   i   i
   u   integerN(   u   upperu   loweru   both(   t   _nbinsRA   t
   _symmetricR-   Rx   t   _pruneR   t   _min_n_ticksR	   t   arrayt   _stepsR)  R+  t   _extended_stepst   _integer(   R   R.   R!  R  (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR   W  s,    

3c         C` s  |  j  d k rX |  j d  k	 rO t j |  j j   t d |  j d  d  } qa d } n	 |  j  } t | | |  \ } } | | } | | } | | | } |  j	 | }	 |  j
 r |	 d k  t j |	 t j |	   d k  B}
 |	 |
 }	 n  t j |	 | k  d d } t d d k rpxV t | t |	   D]< } |	 | } | | | } | | | } | | k r-Pq-q-Wn  xt |  D]} |	 | | } |  j
 rt j |  t j |  |  j d k rt d |  } n  | | | } t j t |  j | |  |  } t j t |  j | |  |  } t j | | d  | | | } | | k | | k @j   } | |  j k r}Pq}q}W| S(   Nu   autoi   i	   gMbP?i    u   axes.autolimit_modeu   round_numbers(   R,  R+   R-   R	   R   R'   R   R/  R  R2  R3  RP   R   t   nonzeroR   R   R?   R   R   R  R  R  R   t   sum(   R   R!   R"   R  R  Rm   t   _vmint   _vmaxt   raw_stepR  t   igoodt   istepR   t	   best_vmint	   best_vmaxRB   t   lowt   highR   t   nticks(    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt
   _raw_ticksq  sF    		

	,
	)&&"c         C` s%   |  j  j   \ } } |  j | |  S(   N(   R+   R    R   (   R   R!   R"   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR4     s    c         C` s   |  j  r. t t |  t |   } | } n  t j | | d d d d \ } } |  j | |  } |  j } | d k r | d } n5 | d k r | d  } n | d	 k r | d d !} n  |  j |  S(
   NR   gvIh%<=t   tinyg+=u   loweri   u   upperiu   both(   R-  R   RP   R   R   R@  R.  R   (   R   R!   R"   R9   R!  (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR     s    	
	c         C` s   |  j  r. t t |  t |   } | } n  t j | | d d d d \ } } t d d k r| |  j | |  d d g S| | f Sd  S(	   NR   g-q=RA  gvIh%<=u   axes.autolimit_modeu   round_numbersi    i(   R-  R   RP   R   R   R   R@  (   R   R  R  (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR     s    	
N(   R(   R)   R<   t   dictR-   Rl   R#  R   t   staticmethodR)  R+  R   R@  R4   R   R   (    (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR     s   		1		/		i
   c         C` s>   |  d k r | St  j t  j |   t  j |   } | | S(   u#   floor x to the nearest lower decadeg        (   R	   R   R   (   R   R   t   lx(    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt   decade_down  s    %c         C` s=   |  d k r | St  j t  j |   t  j |   } | | S(   u#   ceil x to the nearest higher decadeg        (   R	   R   R   (   R   R   RD  (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt	   decade_up  s    %c         C` sB   |  d k r t  d  S|  d k r0 t  |  d  St  |  d  Sd  S(   Ni    g      ?(   t   long(   R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR     s
    
c         C` sR   t  j |   s t S|  d k r# t St  j t  j |    t  j |  } t |  S(   Ng        (   R	   t   isfiniteRl   Rc   R   RP   R   (   R   R   RD  (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR     s    %c         C` s-   t  j |   s t St |  t |    d k  S(   Ng|=(   R	   RH  Rl   RP   R   (   R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR     s    t
   LogLocatorc           B` sn   e  Z d  Z d d d d d  Z d d d d d  Z d   Z d   Z d   Z d	   Z	 d
   Z
 d   Z RS(   u3   
    Determine the tick locations for log axes
    g      $@g      ?i   c         C` sX   | d k r( t d r d } q( d } n  |  j |  |  j |  | |  _ | |  _ d S(   u  
        Place ticks on the locations : subs[j] * base**i

        Parameters
        ----------
        subs : None, string, or sequence of float, optional, default (1.0,)
            Gives the multiples of integer powers of the base at which
            to place ticks.  The default places ticks only at
            integer powers of the base.
            The permitted string values are ``'auto'`` and ``'all'``,
            both of which use an algorithm based on the axis view
            limits to determine whether and how to put ticks between
            integer powers of the base.  With ``'auto'``, ticks are
            placed only between integer powers; with ``'all'``, the
            integer powers are included.  A value of None is
            equivalent to ``'auto'``.

        u   _internal.classic_modei   u   autoN(   R-   R   R   t   subst   numdecsR   (   R   R   RJ  RK  R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR     s    
			c         C` sl   | d k	 r |  j |  n  | d k	 r8 |  j |  n  | d k	 rP | |  _ n  | d k	 rh | |  _ n  d S(   u#   Set parameters within this locator.N(   R-   R   RJ  RK  R   (   R   R   RJ  RK  R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR     s    c         C` s   t  |  |  _ d S(   uW   
        set the base of the log scaling (major tick every base**i, i integer)
        N(   R   R   (   R   R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR     s    c         C` sq   | d k r d |  _ nU t | t j  rU | d k rI t d |   n  | |  _ n t j | d t |  _ d S(   uO   
        set the minor ticks for the log scaling every base**i*subs[j]
        u   autou   allu2   A subs string must be 'all' or 'auto'; found '%s'.t   dtypeN(   u   allu   auto(	   R-   t   _subsR   R   R   Rx   R	   R   R   (   R   RJ  (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyRJ  !  s    c         C` s%   |  j  j   \ } } |  j | |  S(   u!   Return the locations of the ticks(   R+   R    R   (   R   R!   R"   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR4   /  s    c         C` s  |  j  d k rH |  j d  k	 r? t j |  j j   d d  } qQ d } n	 |  j  } |  j } t |  j d  r |  j j j	 d k r t
 j t
 j |  t
 j |   } t j | |  j |  } | | } | S| d k r(|  j d  k	 r |  j j   } n  | d k st j |  r(t d   q(n  t
 j |  t
 j |  } t
 j |  t
 j |  } | | k  r|| | } } n  t
 j |  t
 j |  } t |  j t j  r&|  j d k rd n d	 } | d
 k s| d k  r|  j d k rt j g   St j d	 g  }	 q/t j | |  }	 n	 |  j }	 d }
 t d rgxJ | |
 d | k rc|
 d 7}
 qBWn% x" | |
 d | k r|
 d 7}
 qjWt |	  d k pt |	 d k  o|	 d d	 k } t j t
 j |  |
 t
 j |  d |
 |
  } t |  d  rV|  j j   j |  } | r|
 d k rJt j t j |	 |   } qSg  } qnN | rg  } |
 d k rx& | | D] } | j |	 |  qyWqn
 | | } |  j  t j! |   S(   Nu   autoi   i	   u   axesu   polarg        uA   Data has no positive values, and therefore can not be log-scaled.g       @g      ?i
   i   i   u   _internal.classic_modei    u
   _transform("   R   R+   R-   R	   R   R'   R   t   hasattrt   axest   nameR   R   R   R   RK  R$   RH  Rx   R   R   RM  R   R   R0  R   R?   t
   _transformt   invertedt	   transformt   ravelt   outert   extendR   R   (   R   R!   R"   R   Rv   t   decadesR  R   t   _firstRJ  t   stridet	   have_subst   decadeStart(    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR   4  sh    !			'%
	
4
c         C` s   |  j  } |  j | |  \ } } |  j j j d k ro t j t j |  t j |   } | | |  j } n  t	 d d k r t
 | |  j   s t | |  j   } n  t
 | |  j   s t | |  j   } q n  | | f S(   u+   Try to choose the view limits intelligentlyu   polaru   axes.autolimit_modeu   round_numbers(   R   R   R+   RO  RP  R   R   R   RK  R   R   RE  RF  (   R   R!   R"   Rv   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR     s    	%c         C` s   t  j |  s  t  j |  r$ d S| | k r@ | | } } n  | d k r] t j d  d S|  j j   } t  j |  s d } n  | d k r | } n  | | k r t | |  j  } t | |  j  } n  | | f S(   Ni   i
   i    u@   Data has no positive values, and therefore cannot be log-scaled.gYn(   i   i
   (   i   i
   (	   R	   RH  R   R   R+   R$   RE  R   RF  (   R   R!   R"   R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR     s"     		(   g      ?N(   R(   R)   R<   R-   R   R   R   RJ  R4   R   R   R   (    (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyRI    s   				Q	t   SymmetricalLogLocatorc           B` sM   e  Z d  Z d d d d d  Z d d d  Z d   Z d   Z d   Z RS(   u=   
    Determine the tick locations for symmetric log axes
    c         C` s   | d k	 r' | j |  _ | j |  _ n9 | d k	 rT | d k	 rT | |  _ | |  _ n t d   | d k r{ d g |  _ n	 | |  _ d |  _ d S(   u>   
        place ticks on the location= base**i*subs[j]
        u?   Either transform, or both linthresh and base, must be provided.g      ?i   N(   R-   R   R   R   R   Rx   RM  R   (   R   RS  RJ  R   R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR     s    		c         C` s4   | d k	 r | |  _ n  | d k	 r0 | |  _ n  d S(   u#   Set parameters within this locator.N(   R-   R   RM  (   R   RJ  R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR     s    c         C` s%   |  j  j   \ } } |  j | |  S(   u!   Return the locations of the ticks(   R+   R    R   (   R   R!   R"   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR4     s    c         ` s!  |  j    |  j } | | k  r. | | } } n  t } } } | | k  r} t } | | k r t } | | k rz t } qz q n} | d k  r | d k r t } | | k r t } q q | | g Sn: | | k  r | | k r t } t } q | | g Sn t }   f d   } | rD| r,| | | d  } qJ| | | d  } n d } | r| rl| | | d  }	 q| | | d  }	 n d	 }	 | d | d |	 d |	 d }
 | r|
 d 7}
 n  t |
 |  j d d  } g  } | r| j d   t j | d | d |  d  d  d   n  | r5| j	 d  n  | rf| j   t j |	 d |	 d |   n  |  j
 d  k rt j d    } n t j |  j
  } t |  d k s| d d k rg  } xD | D]3 } | d k r| j	 |  q| j | |  qWn | } |  j t j |   S(
   Ni    c         ` sT   t  j t  j |   t  j     }  t  j t  j |  t  j     } |  | f S(   N(   R	   R   R   R   (   t   lot   hi(   Rv   (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt   get_log_range	  s    %%i   ig        g       @g      ?(   i    i    (   i    i    (   R   R   Rl   Rc   R   R   RV  R	   R   t   appendRM  R-   R   R?   R   R0  (   R   R!   R"   t   tt   has_at   has_bt   has_cR_  t   a_ranget   c_ranget   total_ticksRY  RW  RJ  R  t   decade(    (   Rv   s0   lib/python2.7/site-packages/matplotlib/ticker.pyR     sr    			" +"c         C` s:  |  j  } | | k  r% | | } } n  t d d k r$t t |  |  s| | d k  rj t | |  } q| t | |  } n  t t |  |  s | d k  r t | |  } q t | |  } n  | | k r$| d k  r t | |  } t | |  } q!t | |  } t | |  } q$n  t j | |  } | S(   u+   Try to choose the view limits intelligentlyu   axes.autolimit_modeu   round_numbersi    (   R   R   R   RP   RF  RE  R   R   (   R   R!   R"   Rv   t   result(    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR   =	  s(    	N(	   R(   R)   R<   R-   R   R   R4   R   R   (    (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR\    s   		jt   LogitLocatorc           B` sA   e  Z d  Z e d  Z d d  Z d   Z d   Z d   Z	 RS(   u5   
    Determine the tick locations for logit axes
    c         C` s   | |  _  d S(   u4   
        place ticks on the logit locations
        N(   t   minor(   R   Rk  (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR   `	  s    c         C` s   | d k	 r | |  _ n  d S(   u#   Set parameters within this locator.N(   R-   Rk  (   R   Rk  (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR   f	  s    c         C` s%   |  j  j   \ } } |  j | |  S(   u!   Return the locations of the ticks(   R+   R    R   (   R   R!   R"   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR4   k	  s    c         C` s  t  |  j d  r6 |  j j j d k r6 t d   n  |  j | |  \ } } t j | d |  } t j | d |  } t j |  } t j	 |  } |  j
 scg  } | d k r t j | t d | d   } | j t d |   n  | d k r| d k r| j d  n  | d k rvt j t d |  | d  } | j t d d |   qvng  } | d	 k rt j | t d |   } t j t j d
 d  d |  j   } | j t |   n  | d k r| d k r| j d d d d d d g  n  | d
 k rvt j t d
 |  | d  } d t j t j d
 d  d |  j   } | j t |   n  |  j t j |   S(   Nu   axesu   polaru%   Polar axis cannot be logit scaled yeti   ii    i
   g      ?ii   g?g333333?g?g333333?gffffff?g?(   RN  R+   RO  RP  R2   R   R	   R   R   R   Rk  R   R   RV  R   R`  R   RU  RT  R   R0  (   R   R!   R"   t
   decade_mint
   decade_maxR  t   expot   newticks(    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR   p	  s:    '	 !(" ,c         C` s   d d f } t  j |  s, t  j |  r0 | S| | k rL | | } } n  |  j d  k	 r |  j j   } t  j |  s | Sn d } | d k r | } n  | d k r d | } n  | | k r d | d d | f S| | f S(   NgHz>i   i    g?gP?(   R	   RH  R+   R-   R$   (   R   R!   R"   t   initial_rangeR   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR   	  s"     	N(
   R(   R)   R<   Rl   R   R-   R   R4   R   R   (    (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyRj  [	  s   		(t   AutoLocatorc           B` s   e  Z d  Z d   Z RS(   u   
    Dynamically find major tick positions. This is actually a subclass
    of `~matplotlib.ticker.MaxNLocator`, with parameters *nbins = 'auto'*
    and *steps = [1, 2, 2.5, 5, 10]*.
    c         C` s]   t  d r% d } d d d d g } n d } d d d d d g } t j |  d	 | d
 | d S(   u   
        To know the values of the non-public parameters, please have a
        look to the defaults of `~matplotlib.ticker.MaxNLocator`.
        u   _internal.classic_modei	   i   i   i   i
   u   autog      @R  R  N(   R   R  R   (   R   R  R  (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR   	  s    
(   R(   R)   R<   R   (    (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyRq  	  s   t   AutoMinorLocatorc           B` s,   e  Z d  Z d d  Z d   Z d   Z RS(   u   
    Dynamically find minor tick positions based on the positions of
    major ticks. The scale must be linear with major ticks evenly spaced.
    c         C` s   | |  _  d S(   u   
        *n* is 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 omitted or None, it will be set to 5 or 4.
        N(   t   ndivs(   R   R@   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR   	  s    c         C` s  |  j  j   d k r& t j d  g  S|  j  j   } y | d | d } Wn t k
 r_ g  SX|  j d	 k r t t	 j
 d t	 j |  d   } | d
 k r d } q d } n	 |  j } | | } |  j  j   \ } } | | k r | | } } n  | d } | | | d | }	 | | | d | }
 t	 j |	 |
 |  | } t	 j | | |  | d k } | j |  } |  j t	 j |   S(   u!   Return the locations of the ticksu   logu5   AutoMinorLocator does not work with logarithmic scalei   i    i
   i   i   g      $@N(   i   i   i
   (   R+   t	   get_scaleR   R   t   get_majorticklocsR   Rs  R-   RA   R	   R   R   R    R   RP   t   compressR   R0  (   R   t	   majorlocst	   majorstepR   Rs  t	   minorstepR!   R"   t   t0t   tmint   tmaxR9   t   cond(    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR4   	  s2    &			

!c         C` s   t  d t |     d  S(   Nu(   Cannot get tick locations for a %s type.(   R2   R   (   R   R!   R"   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR   
  s    N(   R(   R)   R<   R-   R   R4   R   (    (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyRr  	  s   
	)t   OldAutoLocatorc           B` sD   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   uo   
    On autoscale this class picks the best MultipleLocator to set the
    view limits and the tick locs.

    c         C` s   t    |  _ d  S(   N(   R	  t   _locator(   R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR   
  s    c         C` s   |  j    |  j |  j    S(   u!   Return the locations of the ticks(   R  R   R  (   R   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR4   
  s    
c         C` s   t  d t |     d  S(   Nu(   Cannot get tick locations for a %s type.(   R2   R   (   R   R!   R"   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR   
  s    c         C` sY   |  j  j   \ } } t j | | d d \ } } t | |  } |  j |  |  _ d S(   u1   refresh internal information based on current limR   g?N(   R+   R    R   R   RP   t   get_locatorR  (   R   R!   R"   RT   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR  
  s    c         C` s5   t  | |  } |  j |  |  _ |  j j | |  S(   u+   Try to choose the view limits intelligently(   RP   R  R  R   (   R   R!   R"   RT   (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR   !
  s    c         C` s   t  |  } | d k r' t d  } n y t j |  } Wn t k
 rY t d   n Xt j |  } d | } | d | k r | } n' | d | k r | d } n
 | d } t |  } | S(	   u)   pick the best locator based on a distancei    g?u'   AutoLocator illegal data interval rangei
   i   i   g       @g      @(   RP   R  R   R   t   OverflowErrorR   R   (   R   RT   t   locatort   ldt   fldR   t   ticksize(    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR  (
  s     
	
(	   R(   R)   R<   R   R4   R   R  R   R  (    (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyR~  
  s   					(B   R<   t
   __future__R    R   R   R   R   R   R{   R   t   numpyR	   t
   matplotlibR   R   R   R   t   matplotlib.cbookR   R   t   __all__t   PY3RA   RG  R   R   t   objectR   R*   R1   R=   RC   RD   RI   RK   RM   RO   R]   R   R   R   R   R   R   R   R   R  R  R  R	  R  R  R  R  R  RE  RF  R   R   R   RI  R\  Rj  Rq  Rr  R~  (    (    (    s0   lib/python2.7/site-packages/matplotlib/ticker.pyt   <module>   s   "										5!2 DF~tc.I	).				\=