B
    ò¶I`G\  ã               @   sò  d 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mZm	Z	 ddl
mZmZmZmZmZmZmZmZmZmZ ddlmZmZ ddlmZ G dd	„ d	ƒZG d
d„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZ G dd„ de ƒZ!G dd„ deƒZ"G dd„ deƒZ#G dd„ deƒZ$G dd„ deƒZ%G d d!„ d!eƒZ&G d"d#„ d#eƒZ'ee e$e'ee!d$œZ(d%d&„ Z)d'd(„ Z*e*j �r²e*j d)d* +e,e-e)ƒ ƒ¡i e*_ d+d,„ Z.d-d.„ Z/e	j0j1d/d* +d0d1„ e)ƒ D ƒ¡ e/ƒ  2¡ d2� dS )3a  
Scales define the distribution of data values on an axis, e.g. a log scaling.

They are attached to an `~.axis.Axis` and hold a `.Transform`, which is
responsible for the actual data transformation.

See also `.axes.Axes.set_xscale` and the scales examples in the documentation.
é    N)Úma)ÚcbookÚ	docstring)
ÚNullFormatterÚScalarFormatterÚLogFormatterSciNotationÚLogitFormatterÚNullLocatorÚ
LogLocatorÚAutoLocatorÚAutoMinorLocatorÚSymmetricalLogLocatorÚLogitLocator)Ú	TransformÚIdentityTransform)Úwarn_deprecatedc               @   s0   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
S )Ú	ScaleBasea:  
    The base class for all scales.

    Scales are separable transformations, working on a single dimension.

    Any subclasses will want to override:

    - :attr:`name`
    - :meth:`get_transform`
    - :meth:`set_default_locators_and_formatters`

    And optionally:

    - :meth:`limit_range_for_scale`

    c             K   s&   |r"t dddtt|ƒƒ›d�d� dS )a‰  
        Construct a new scale.

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

        For back-compatibility reasons, scales take an `~matplotlib.axis.Axis`
        object as first argument.  However, this argument should not
        be used: a single scale object should be usable by multiple
        `~matplotlib.axis.Axis`\es at the same time.
        z3.2z3.4z-ScaleBase got an unexpected keyword argument z(. This will become an error %(removal)s.)ÚremovalÚmessageN)r   ÚnextÚiter)ÚselfÚaxisÚkwargs© r   ú4/tmp/pip-unpacked-wheel-tvo012g9/matplotlib/scale.pyÚ__init__,   s    zScaleBase.__init__c             C   s
   t ƒ ‚dS )zq
        Return the :class:`~matplotlib.transforms.Transform` object
        associated with this scale.
        N)ÚNotImplementedError)r   r   r   r   Úget_transformB   s    zScaleBase.get_transformc             C   s
   t ƒ ‚dS )zi
        Set the locators and formatters of *axis* to instances suitable for
        this scale.
        N)r   )r   r   r   r   r   Ú#set_default_locators_and_formattersI   s    z-ScaleBase.set_default_locators_and_formattersc             C   s   ||fS )zú
        Return the range *vmin*, *vmax*, restricted to the
        domain supported by this scale (if any).

        *minpos* should be the minimum positive value in the data.
        This is used by log scales to determine a minimum value.
        r   )r   ÚvminÚvmaxÚminposr   r   r   Úlimit_range_for_scaleP   s    zScaleBase.limit_range_for_scaleN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r#   r   r   r   r   r      s
   r   c                   s4   e Zd ZdZdZ‡ fdd„Zdd„ Zdd„ Z‡  ZS )	ÚLinearScalez#
    The default linear scale.
    Úlinearc                s   t ƒ j|f|Ž dS )z	
        N)Úsuperr   )r   r   r   )Ú	__class__r   r   r   b   s    zLinearScale.__init__c             C   sj   |  tƒ ¡ | tƒ ¡ | tƒ ¡ |jdkr8tjd sL|jdkrZtjd rZ| 	t
ƒ ¡ n| 	tƒ ¡ d S )NÚxzxtick.minor.visibleÚyzytick.minor.visible)Úset_major_locatorr   Úset_major_formatterr   Úset_minor_formatterr   Ú	axis_nameÚmplÚrcParamsÚset_minor_locatorr   r	   )r   r   r   r   r   r   j   s    z/LinearScale.set_default_locators_and_formattersc             C   s   t ƒ S )z€
        Return the transform for linear scaling, which is just the
        `~matplotlib.transforms.IdentityTransform`.
        )r   )r   r   r   r   r   v   s    zLinearScale.get_transform)	r$   r%   r&   r'   Únamer   r   r   Ú__classcell__r   r   )r+   r   r(   [   s
   r(   c                   s8   e Zd ZdZd ZZ‡ fdd„Zdd„ Zdd„ Z‡  Z	S )	ÚFuncTransformzi
    A simple transform that takes and arbitrary function for the
    forward and inverse transform.
    é   c                s4   t ƒ  ¡  t|ƒr(t|ƒr(|| _|| _ntdƒ‚dS )a£  
        Parameters
        ----------
        forward : callable
            The forward function for the transform.  This function must have
            an inverse and, for best behavior, be monotonic.
            It must have the signature::

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

        inverse : callable
            The inverse of the forward function.  Signature as ``forward``.
        z,arguments to FuncTransform must be functionsN)r*   r   ÚcallableÚ_forwardÚ_inverseÚ
ValueError)r   ÚforwardÚinverse)r+   r   r   r   †   s
    
zFuncTransform.__init__c             C   s
   |   |¡S )N)r:   )r   Úvaluesr   r   r   Útransform_non_affine›   s    z"FuncTransform.transform_non_affinec             C   s   t | j| jƒS )N)r7   r;   r:   )r   r   r   r   Úinvertedž   s    zFuncTransform.inverted)
r$   r%   r&   r'   Ú
input_dimsÚoutput_dimsr   r@   rA   r6   r   r   )r+   r   r7   ~   s
   r7   c               @   s,   e Zd ZdZdZdd„ Zdd„ Zdd„ Zd	S )
Ú	FuncScalezN
    Provide an arbitrary scale with user-supplied function for the axis.
    Úfunctionc             C   s   |\}}t ||ƒ}|| _dS )a•  
        Parameters
        ----------
        axis : `~matplotlib.axis.Axis`
            The axis for the scale.
        functions : (callable, callable)
            two-tuple of the forward and inverse functions for the scale.
            The forward function must be monotonic.

            Both functions must have the signature::

               def forward(values: array-like) -> array-like
        N)r7   Ú
_transform)r   r   Ú	functionsr=   r>   Ú	transformr   r   r   r   ©   s    
zFuncScale.__init__c             C   s   | j S )z7Return the `.FuncTransform` associated with this scale.)rF   )r   r   r   r   r   »   s    zFuncScale.get_transformc             C   sj   |  tƒ ¡ | tƒ ¡ | tƒ ¡ |jdkr8tjd sL|jdkrZtjd rZ| 	t
ƒ ¡ n| 	tƒ ¡ d S )Nr,   zxtick.minor.visibler-   zytick.minor.visible)r.   r   r/   r   r0   r   r1   r2   r3   r4   r   r	   )r   r   r   r   r   r   ¿   s    z-FuncScale.set_default_locators_and_formattersN)r$   r%   r&   r'   r5   r   r   r   r   r   r   r   rD   ¢   s
   rD   c               @   sD   e Zd Zd ZZe ddd¡ddd„ƒZdd	„ Zd
d„ Z	dd„ Z
dS )ÚLogTransformr8   z3.3ÚnonposÚnonpositiveÚclipc             C   sB   t  | ¡ |dks|dkr"tdƒ‚|| _tjdddœ|d�| _d S )Nr   r8   z#The log base cannot be <= 0 or == 1TF)rL   Úmask)rK   )r   r   r<   Úbaser   Z_check_getitemÚ_clip)r   rN   rK   r   r   r   r   Ï   s    
zLogTransform.__init__c             C   s    d  t| ƒj| j| jrdnd¡S )Nz{}(base={}, nonpositive={!r})rL   rM   )ÚformatÚtyper$   rN   rO   )r   r   r   r   Ú__str__Ø   s    zLogTransform.__str__c          	   C   sx   t jddd��` t jt jdt jdt ji | j¡}|r>||ƒ}nt  |¡}|t  | j¡ }| jrjd||dk< W d Q R X |S )NÚignore)ÚdivideÚinvalidé   é
   iüÿÿr   )	ÚnpÚerrstateÚeÚlogÚlog2Úlog10ÚgetrN   rO   )r   Úar[   Úoutr   r   r   r@   Ü   s     


z!LogTransform.transform_non_affinec             C   s
   t | jƒS )N)ÚInvertedLogTransformrN   )r   r   r   r   rA   ò   s    zLogTransform.invertedN)rL   )r$   r%   r&   rB   rC   r   Ú_rename_parameterr   rR   r@   rA   r   r   r   r   rI   Ì   s   rI   c               @   s4   e Zd Zd ZZdd„ Zdd„ Zdd„ Zdd	„ Zd
S )ra   r8   c             C   s   t  | ¡ || _d S )N)r   r   rN   )r   rN   r   r   r   r   ù   s    
zInvertedLogTransform.__init__c             C   s   d  t| ƒj| j¡S )Nz{}(base={}))rP   rQ   r$   rN   )r   r   r   r   rR   ý   s    zInvertedLogTransform.__str__c             C   s   t  | j|¡S )N)r   ÚpowerrN   )r   r_   r   r   r   r@      s    z)InvertedLogTransform.transform_non_affinec             C   s
   t | jƒS )N)rI   rN   )r   r   r   r   rA     s    zInvertedLogTransform.invertedN)	r$   r%   r&   rB   rC   r   rR   r@   rA   r   r   r   r   ra   ö   s
   ra   c               @   st   e Zd ZdZdZejddd�edd„ ƒƒZejddd�ed	d
„ ƒƒZ	dd„ Z
edd„ ƒZdd„ Zdd„ Zdd„ ZdS )ÚLogScalezT
    A standard logarithmic scale.  Care is taken to only plot positive values.
    r[   z3.3zscale.LogTransform)Úalternativec             C   s   t S )N)rI   )r   r   r   r   rI     s    zLogScale.LogTransformzscale.InvertedLogTransformc             C   s   t S )N)ra   )r   r   r   r   ra     s    zLogScale.InvertedLogTransformc             K   s€   t |ddƒ}t dd|› �d¡t dd|› �d¡t dd|› �d¡dd	d
dœdd„ƒƒƒ}|f |Ž\}}}t||ƒ| _|| _d	S )a£  
        Parameters
        ----------
        axis : `~matplotlib.axis.Axis`
            The axis for the scale.
        base : float, default: 10
            The base of the logarithm.
        nonpositive : {'clip', 'mask'}, default: 'clip'
            Determines the behavior for non-positive values. They can either
            be masked as invalid, or clipped to a very small positive number.
        subs : sequence of int, default: None
            Where to place the subticks between each major tick.  For example,
            in a log10 scale, ``[2, 3, 4, 5, 6, 7, 8, 9]`` will place 8
            logarithmically spaced minor ticks between each major tick.
        r1   r,   z3.3rN   ÚsubsrJ   rK   rW   NrL   )rN   rf   rK   c             S   s
   | ||fS )Nr   )rN   rf   rK   r   r   r   r   ,  s    z#LogScale.__init__.<locals>.__init__)Úgetattrr   rb   rI   rF   rf   )r   r   r   r1   r   rN   rf   rK   r   r   r   r     s    zLogScale.__init__c             C   s   | j jS )N)rF   rN   )r   r   r   r   Ú<lambda>6  s    zLogScale.<lambda>c             C   sR   |  t| jƒ¡ | t| jƒ¡ | t| j| jƒ¡ | t| j| jd k	d�¡ d S )N)ZlabelOnlyBase)r.   r
   rN   r/   r   r4   rf   r0   )r   r   r   r   r   r   8  s    z,LogScale.set_default_locators_and_formattersc             C   s   | j S )z6Return the `.LogTransform` associated with this scale.)rF   )r   r   r   r   r   A  s    zLogScale.get_transformc             C   s.   t  |¡sd}|dkr|n||dkr(|n|fS )z$Limit the domain to positive values.gYóøÂn¥r   )rX   Úisfinite)r   r    r!   r"   r   r   r   r#   E  s    
zLogScale.limit_range_for_scaleN)r$   r%   r&   r'   r5   r   Ú
deprecatedÚpropertyrI   ra   r   rN   r   r   r#   r   r   r   r   rd     s   	rd   c               @   s2   e Zd ZdZdZddd„Zedd„ ƒZdd	„ Zd
S )ÚFuncScaleLogzu
    Provide an arbitrary scale with user-supplied function for the axis and
    then put on a logarithmic axes.
    ÚfunctionlogrW   c             C   s&   |\}}d| _ t||ƒt|ƒ | _dS )aã  
        Parameters
        ----------
        axis : `matplotlib.axis.Axis`
            The axis for the scale.
        functions : (callable, callable)
            two-tuple of the forward and inverse functions for the scale.
            The forward function must be monotonic.

            Both functions must have the signature::

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

        base : float, default: 10
            Logarithmic base of the scale.
        N)rf   r7   rI   rF   )r   r   rG   rN   r=   r>   r   r   r   r   V  s    zFuncScaleLog.__init__c             C   s
   | j jjS )N)rF   Ú_brN   )r   r   r   r   rN   k  s    zFuncScaleLog.basec             C   s   | j S )z3Return the `.Transform` associated with this scale.)rF   )r   r   r   r   r   o  s    zFuncScaleLog.get_transformN)rW   )	r$   r%   r&   r'   r5   r   rk   rN   r   r   r   r   r   rl   N  s
   
rl   c               @   s,   e Zd Zd ZZdd„ Zdd„ Zdd„ ZdS )	ÚSymmetricalLogTransformr8   c             C   sp   t  | ¡ |dkrtdƒ‚|dkr*tdƒ‚|dkr:tdƒ‚|| _|| _|| _|d| jd   | _t |¡| _	d S )Ng      ð?z'base' must be larger than 1g        z'linthresh' must be positivez'linscale' must be positiveéÿÿÿÿ)
r   r   r<   rN   Ú	linthreshÚlinscaleÚ_linscale_adjrX   r[   Ú	_log_base)r   rN   rq   rr   r   r   r   r   w  s    
z SymmetricalLogTransform.__init__c          	   C   sp   t  |¡}t jddd��< t  |¡| j | jt  || j ¡| j   }|| jk}W d Q R X || | j ||< |S )NrS   )rT   rU   )rX   ÚabsrY   Úsignrq   rs   r[   rt   )r   r_   Úabs_ar`   Úinsider   r   r   r@   …  s    
z,SymmetricalLogTransform.transform_non_affinec             C   s   t | j| j| jƒS )N)ÚInvertedSymmetricalLogTransformrN   rq   rr   )r   r   r   r   rA   �  s    
z SymmetricalLogTransform.invertedN)r$   r%   r&   rB   rC   r   r@   rA   r   r   r   r   ro   t  s   
ro   c               @   s,   e Zd Zd ZZdd„ Zdd„ Zdd„ ZdS )	ry   r8   c             C   sL   t  | ¡ t|||ƒ}|| _|| _| |¡| _|| _|d| jd   | _d S )Ng      ð?rp   )	r   r   ro   rN   rq   rH   Úinvlinthreshrr   rs   )r   rN   rq   rr   Úsymlogr   r   r   r   —  s    
z(InvertedSymmetricalLogTransform.__init__c          	   C   sn   t  |¡}t jddd��: t  |¡| j t  | j|| j | j ¡ }|| jk}W d Q R X || | j ||< |S )NrS   )rT   rU   )	rX   ru   rY   rv   rq   rc   rN   rs   rz   )r   r_   rw   r`   rx   r   r   r   r@      s    
z4InvertedSymmetricalLogTransform.transform_non_affinec             C   s   t | j| j| jƒS )N)ro   rN   rq   rr   )r   r   r   r   rA   ª  s    z(InvertedSymmetricalLogTransform.invertedN)r$   r%   r&   rB   rC   r   r@   rA   r   r   r   r   ry   ”  s   	
ry   c               @   s„   e Zd ZdZdZejddd�edd„ ƒƒZejddd�ed	d
„ ƒƒZ	dd„ Z
edd„ ƒZedd„ ƒZedd„ ƒZdd„ Zdd„ ZdS )ÚSymmetricalLogScalea  
    The symmetrical logarithmic scale is logarithmic in both the
    positive and negative directions from the origin.

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

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

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

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

    linscale : float, optional
        This allows the linear range ``(-linthresh, linthresh)`` to be
        stretched relative to the logarithmic range. Its value is the number of
        decades to use for each half of the linear range. For example, when
        *linscale* == 1.0 (the default), the space used for the positive and
        negative halves of the linear range will be equal to one decade in
        the logarithmic range.
    r{   z3.3zscale.SymmetricalLogTransform)re   c             C   s   t S )N)ro   )r   r   r   r   ro   Ñ  s    z+SymmetricalLogScale.SymmetricalLogTransformz%scale.InvertedSymmetricalLogTransformc             C   s   t S )N)ry   )r   r   r   r   ry   Ö  s    z3SymmetricalLogScale.InvertedSymmetricalLogTransformc       	   	   K   sš   t |ddƒ}t dd|› �d¡t dd|› �d¡t dd|› �d¡t dd|› �d¡dd	d d
dœdd„ƒƒƒƒ}|f |Ž\}}}}t|||ƒ| _|| _d S )Nr1   r,   z3.3rN   rq   rf   rr   rW   rV   r8   )rN   rq   rf   rr   c             [   s.   |r"t dddtt|ƒƒ›d�d� | |||fS )Nz3.2z3.4z7SymmetricalLogScale got an unexpected keyword argument z(. This will become an error %(removal)s.)r   r   )r   r   r   )rN   rq   rf   rr   r   r   r   r   r   ß  s
    z.SymmetricalLogScale.__init__.<locals>.__init__)rg   r   rb   ro   rF   rf   )	r   r   r   r1   r   rN   rq   rf   rr   r   r   r   r   Ü  s    zSymmetricalLogScale.__init__c             C   s   | j jS )N)rF   rN   )r   r   r   r   rh   ò  s    zSymmetricalLogScale.<lambda>c             C   s   | j jS )N)rF   rq   )r   r   r   r   rh   ó  s    c             C   s   | j jS )N)rF   rr   )r   r   r   r   rh   ô  s    c             C   sH   |  t|  ¡ ƒ¡ | t| jƒ¡ | t|  ¡ | jƒ¡ | t	ƒ ¡ d S )N)
r.   r   r   r/   r   rN   r4   rf   r0   r   )r   r   r   r   r   r   ö  s
    
z7SymmetricalLogScale.set_default_locators_and_formattersc             C   s   | j S )zAReturn the `.SymmetricalLogTransform` associated with this scale.)rF   )r   r   r   r   r   þ  s    z!SymmetricalLogScale.get_transformN)r$   r%   r&   r'   r5   r   rj   rk   ro   ry   r   rN   rq   rr   r   r   r   r   r   r   r|   ¯  s   r|   c               @   sD   e Zd Zd ZZe ddd¡ddd„ƒZdd	„ Zd
d„ Z	dd„ Z
dS )ÚLogitTransformr8   z3.3rJ   rK   rM   c             C   s6   t  | ¡ tjddg|d� || _dddœ| | _d S )NrM   rL   )rK   TF)rL   rM   )r   r   r   Ú_check_in_listÚ_nonpositiverO   )r   rK   r   r   r   r     s    
zLogitTransform.__init__c          	   C   sN   t jddd�� t  |d|  ¡}W dQ R X | jrJd||dk< d|d|k< |S )z,logit transform (base 10), masked or clippedrS   )rT   rU   r8   Niüÿÿr   iè  )rX   rY   r]   rO   )r   r_   r`   r   r   r   r@     s    z#LogitTransform.transform_non_affinec             C   s
   t | jƒS )N)ÚLogisticTransformr   )r   r   r   r   rA     s    zLogitTransform.invertedc             C   s   d  t| ƒj| j¡S )Nz{}({!r}))rP   rQ   r$   r   )r   r   r   r   rR     s    zLogitTransform.__str__N)rM   )r$   r%   r&   rB   rC   r   rb   r   r@   rA   rR   r   r   r   r   r}     s   	r}   c               @   sD   e Zd Zd ZZe ddd¡ddd„ƒZdd	„ Zd
d„ Z	dd„ Z
dS )r€   r8   z3.3rJ   rK   rM   c             C   s   t  | ¡ || _d S )N)r   r   r   )r   rK   r   r   r   r      s    
zLogisticTransform.__init__c             C   s   ddd|    S )zlogistic transform (base 10)g      ð?r8   rW   r   )r   r_   r   r   r   r@   %  s    z&LogisticTransform.transform_non_affinec             C   s
   t | jƒS )N)r}   r   )r   r   r   r   rA   )  s    zLogisticTransform.invertedc             C   s   d  t| ƒj| j¡S )Nz{}({!r}))rP   rQ   r$   r   )r   r   r   r   rR   ,  s    zLogisticTransform.__str__N)rM   )r$   r%   r&   rB   rC   r   rb   r   r@   rA   rR   r   r   r   r   r€     s   r€   c               @   sL   e Zd ZdZdZe ddd¡dddd	œd
d„ƒZdd„ Zdd„ Z	dd„ Z
dS )Ú
LogitScalezÜ
    Logit scale for data between zero and one, both excluded.

    This scale is similar to a log scale close to zero and to one, and almost
    linear around 0.5. It maps the interval ]0, 1[ onto ]-infty, +infty[.
    Úlogitz3.3rJ   rK   rM   z\frac{1}{2}F)Úone_halfÚuse_overlinec            C   s   t |ƒ| _|| _|| _dS )a„  
        Parameters
        ----------
        axis : `matplotlib.axis.Axis`
            Currently unused.
        nonpositive : {'mask', 'clip'}
            Determines the behavior for values beyond the open interval ]0, 1[.
            They can either be masked as invalid, or clipped to a number very
            close to 0 or 1.
        use_overline : bool, default: False
            Indicate the usage of survival notation (\overline{x}) in place of
            standard notation (1-x) for probability close to one.
        one_half : str, default: r"\frac{1}{2}"
            The string used for ticks formatter to represent 1/2.
        N)r}   rF   Ú_use_overlineÚ	_one_half)r   r   rK   rƒ   r„   r   r   r   r   9  s    
zLogitScale.__init__c             C   s   | j S )z8Return the `.LogitTransform` associated with this scale.)rF   )r   r   r   r   r   O  s    zLogitScale.get_transformc             C   sN   |  tƒ ¡ | t| j| jd�¡ | tdd�¡ | td| j| jd�¡ d S )N)rƒ   r„   T)Úminor)r‡   rƒ   r„   )r.   r   r/   r   r†   r…   r4   r0   )r   r   r   r   r   r   S  s    z.LogitScale.set_default_locators_and_formattersc             C   s2   t  |¡sd}|dkr|n||dkr,d| n|fS )zH
        Limit the domain to values between 0 and 1 (excluded).
        gH¯¼šò×z>r   r8   )rX   ri   )r   r    r!   r"   r   r   r   r#   f  s    
z LogitScale.limit_range_for_scaleN)rM   )r$   r%   r&   r'   r5   r   rb   r   r   r   r#   r   r   r   r   r�   0  s   r�   )r)   r[   r{   r‚   rE   rm   c               C   s   t tƒS )z)Return the names of the available scales.)ÚsortedÚ_scale_mappingr   r   r   r   Úget_scale_namesz  s    rŠ   c             K   s&   |   ¡ } tjt| d� t|  |f|ŽS )z€
    Return a scale class by name.

    Parameters
    ----------
    scale : {%(names)s}
    axis : `matplotlib.axis.Axis`
    )Úscale)Úlowerr   r~   r‰   )r‹   r   r   r   r   r   Úscale_factory  s    	r�   Únamesz, c             C   s   | t | j< dS )z�
    Register a new kind of scale.

    Parameters
    ----------
    scale_class : subclass of `ScaleBase`
        The scale to register.
    N)r‰   r5   )Úscale_classr   r   r   Úregister_scale’  s    	r�   c           
   C   sL   g } x<t  ¡ D ]0\}}|  d|›�dt t |j¡d¡dg¡ qW d | ¡S )zF
    Helper function for generating docstrings related to scales.
    z    Ú z        Ú
)	r‰   ÚitemsÚextendÚtextwrapÚindentÚinspectÚgetdocr   Újoin)Zdocsr5   r�   r   r   r   Ú_get_scale_docsž  s    rš   z{%s}c             C   s   g | ]}t |ƒ‘qS r   )Úrepr)Ú.0r,   r   r   r   ú
<listcomp>®  s    r�   )Z
scale_typeZ
scale_docs)3r'   r—   r•   ZnumpyrX   r   Z
matplotlibr2   r   r   Zmatplotlib.tickerr   r   r   r   r	   r
   r   r   r   r   Zmatplotlib.transformsr   r   Zmatplotlib.cbookr   r   r(   r7   rD   rI   ra   rd   rl   ro   ry   r|   r}   r€   r�   r‰   rŠ   r�   r™   Úmapr›   r�   rš   ZinterpdÚupdateÚrstripr   r   r   r   Ú<module>   sN   0A#$**G& TA