3
$ßL]Ü  ã               @   sê  d Z ddlZejd“k redƒ‚ddlZddlmZ ddlmZ ddl	Z	ddl
mZ ddlZddlZddlZdd	lmZ ddlZddlZddlZdd
lmZ ddlZddlZddlZddlZddlZddlmZmZ ddlmZmZm Z m!Z! ddlm"Z" ddl#m$Z$m%Z%m&Z& ddl'Z'ddl(m)Z) e*e)ƒ d ƒZ+[)ej,e-ƒZ.dZ/dd„ Z0dd„ Z1e1ƒ  e2edƒ�sfdge_3ej4ƒ dd„ ƒZ5dd„ Z6d”dd„Z7edd ƒZ8ej4ƒ d!d"„ ƒZ9ej:d#ƒd$d%„ ƒZ;ej:d#ƒd&d'„ ƒZ<de<_=de<_>ej:d#ƒd(d)„ ƒZ?ej:d#ƒd*d+„ ƒZ@de@_>d,d-„ ZAd.d/„ ZBe7d0ƒd1d2„ ƒZCd3d4„ ZDd5d6„ ZEd7d8„ ZFd9d:„ ZGe7d;ƒd<d=„ ƒZHe7d>ƒd?d@„ ƒZIdAdB„ ZJe7dCƒdDdE„ ƒZKej:d#ƒdFdG„ ƒZLdHdI„ ZMi ZNdJd•iZOd–d—d˜d™dLœZPeNeO™ZQG dMdN„ dNeeRƒZSdšdPdQ„ZTejUdRƒZVdSdT„ ZWe	jXdUdV„ ƒZYdWZZd›dXdY„Z[dœd[d\„Z\eTƒ Z]eRj^e]d]ƒ�rbej_j`e]d] ƒ�sbej_jaeMƒ ƒ\ZbZcej_jdebƒZbej_jeebe]d] ƒZfefe]d]< ejgƒ �( eSe]jhƒ ƒZieSd^d_„ e$jjƒ D ƒƒZkW dQ R X eAe]d` ƒe]d`< e]da �rÀejlejmdbƒ dcdd„ Zndedf„ Zodgdh„ ZpdZdiœdjdk„ZqG dldm„ dmƒZrejsd#dndoƒd�dpdq„ƒZtejujvdrƒ�r*ejujvdrƒe]do< dsdt„ Zwdudv„ Zxdwdx„ Zyej:d#dydz�d{d|„ ƒZzd}d~dgZ{d€d�„ Z|džd‚dƒ„Z}dOe}_~d„d…„ Zd†d‡„ Z€dˆZ�d‰Z‚dŠd‹„ ZƒdŸdddŒœd�dŽ„Z„e.j…d�e+ƒ e.j…d�eyƒ ƒ e.j…d‘ej†ƒ e.j…d’e‡ejˆƒƒ dS ) a³  
This is an object-oriented plotting library.

A procedural interface is provided by the companion pyplot module,
which may be imported directly, e.g.::

    import matplotlib.pyplot as plt

or using ipython::

    ipython

at your terminal, followed by::

    In [1]: %matplotlib
    In [2]: import matplotlib.pyplot as plt

at the ipython shell prompt.

For the most part, direct use of the object-oriented library is
encouraged when programming; pyplot is primarily for working
interactively.  The
exceptions are the pyplot commands :func:`~matplotlib.pyplot.figure`,
:func:`~matplotlib.pyplot.subplot`,
:func:`~matplotlib.pyplot.subplots`, and
:func:`~pyplot.savefig`, which can greatly simplify scripting.

Modules include:

    :mod:`matplotlib.axes`
        defines the :class:`~matplotlib.axes.Axes` class.  Most pyplot
        commands are wrappers for :class:`~matplotlib.axes.Axes`
        methods.  The axes module is the highest level of OO access to
        the library.

    :mod:`matplotlib.figure`
        defines the :class:`~matplotlib.figure.Figure` class.

    :mod:`matplotlib.artist`
        defines the :class:`~matplotlib.artist.Artist` base class for
        all classes that draw things.

    :mod:`matplotlib.lines`
        defines the :class:`~matplotlib.lines.Line2D` class for
        drawing lines and markers

    :mod:`matplotlib.patches`
        defines classes for drawing polygons

    :mod:`matplotlib.text`
        defines the :class:`~matplotlib.text.Text`,
        :class:`~matplotlib.text.TextWithDash`, and
        :class:`~matplotlib.text.Annotate` classes

    :mod:`matplotlib.image`
        defines the :class:`~matplotlib.image.AxesImage` and
        :class:`~matplotlib.image.FigureImage` classes

    :mod:`matplotlib.collections`
        classes for efficient drawing of groups of lines or polygons

    :mod:`matplotlib.colors`
        classes for interpreting color specifications and for making
        colormaps

    :mod:`matplotlib.cm`
        colormaps and the :class:`~matplotlib.image.ScalarMappable`
        mixin class for providing color mapping functionality to other
        classes

    :mod:`matplotlib.ticker`
        classes for calculating tick mark locations and for formatting
        tick labels

    :mod:`matplotlib.backends`
        a subpackage with modules for various gui libraries and output
        formats

The base matplotlib namespace includes:

    :data:`~matplotlib.rcParams`
        a global dictionary of default configuration settings.  It is
        initialized by code which may be overridden by a matplotlibrc
        file.

    :func:`~matplotlib.rc`
        a function for setting groups of rcParams values

    :func:`~matplotlib.use`
        a function for setting the matplotlib backend.  If used, this
        function must be called immediately after importing matplotlib
        for the first time.  In particular, it must be called
        **before** importing pyplot (if pyplot is imported).

matplotlib was initially written by John D. Hunter (1968-2012) and is now
developed and maintained by a host of others.

Occasionally the internal documentation (python docstrings) will refer
to MATLAB&reg;, a registered trademark of The MathWorks, Inc.

é    Né   é   a  
Matplotlib 3.0+ does not support Python 2.x, 3.0, 3.1, 3.2, 3.3, or 3.4.
Beginning with Matplotlib 3.0, Python 3.5 and above is required.

See Matplotlib `INSTALL.rst` file for more information:

    https://github.com/matplotlib/matplotlib/blob/master/INSTALL.rst

)Ú
namedtuple)ÚMutableMapping)ÚLooseVersion)Ú	Parameter)ÚPathé   )ÚcbookÚrcsetup)ÚMatplotlibDeprecationWarningÚdedentÚ	get_labelÚsanitize_sequence)ÚmplDeprecation)ÚdefaultParamsÚvalidate_backendÚcycler)Úget_versionsÚversionaì  @Article{Hunter:2007,
  Author    = {Hunter, J. D.},
  Title     = {Matplotlib: A 2D graphics environment},
  Journal   = {Computing in Science \& Engineering},
  Volume    = {9},
  Number    = {3},
  Pages     = {90--95},
  abstract  = {Matplotlib is a 2D graphics package used for Python
  for application development, interactive scripting, and
  publication-quality image generation across user
  interfaces and operating systems.},
  publisher = {IEEE COMPUTER SOC},
  year      = 2007
}c             C   s`   t | tƒr"tjddd� | jdƒ} t |tƒrDtjddd� |jdƒ}| rXt| ƒt|ƒkS dS dS )zCReturn whether version *a* is greater than or equal to version *b*.z3.0z*compare_versions arguments should be strs.)ÚmessageÚasciiFN)Ú
isinstanceÚbytesr
   Úwarn_deprecatedÚdecoder   )ÚaÚb© r   ú;/tmp/pip-install-edjban26/matplotlib/matplotlib/__init__.pyÚcompare_versionsª   s    





r    c              C   sN   ddl m}  x<dD ]4\}}tj|ƒ}t|jƒ|k rtdj|||jƒƒ‚qW d S )Nr	   )Úft2fontr   ú0.10Údateutilú2.1Ú
kiwisolverú1.0.1Únumpyú1.11Ú	pyparsingú2.0.1z'Matplotlib requires {}>={}; you have {}©r   r"   ©r#   r$   ©r%   r&   ©r'   r(   ©r)   r*   )r+   r,   r-   r.   r/   )Ú r!   Ú	importlibÚimport_moduler   Ú__version__ÚImportErrorÚformat)r!   ÚmodnameZminverÚmoduler   r   r   Ú_check_versionsº   s        
r8   ÚargvZ	modpythonc              C   s(   t jƒ } | jt jt jƒƒ tj| ƒ | S )zÙ
    The first time this function is called, attach a `StreamHandler` using the
    same format as `logging.basicConfig` to the Matplotlib root logger.

    Return this handler every time this function is called.
    )ÚloggingÚStreamHandlerÚsetFormatterÚ	FormatterÚBASIC_FORMATÚ_logÚ
addHandler)Úhandlerr   r   r   Ú_ensure_handlerÖ   s    
rB   c             C   s"   t j| jƒ ƒ tƒ j| jƒ ƒ dS )a}  
    Sets the Matplotlib's root logger and root logger handler level, creating
    the handler if it does not exist yet.

    Typically, one should call ``set_loglevel("info")`` or
    ``set_loglevel("debug")`` to get additional debugging information.

    Parameters
    ----------
    level : {"notset", "debug", "info", "warning", "error", "critical"}
        The log level of the handler.

    Notes
    -----
    The first time this function is called, an additional handler is attached
    to Matplotlib's root handler; this handler is reused every time and this
    function simply manipulates the logger and handler's level.
    N)r?   ÚsetLevelÚupperrB   )Úlevelr   r   r   Úset_loglevelä   s    rF   c                s<   ˆdkrt jtˆƒS d‰ d‰t jˆƒ‡ ‡‡‡fdd„ƒ}|S )aL  
    Decorator that logs a function's return value, and memoizes that value.

    After ::

        @_logged_cached(fmt)
        def func(): ...

    the first call to *func* will log its return value at the DEBUG level using
    %-format string *fmt*, and memoize it; later calls to *func* will directly
    return that value.
    NFc                  s   ˆ sˆƒ ‰d‰ t jˆˆƒ ˆS )NT)r?   Údebugr   )ÚcalledÚfmtÚfuncÚretr   r   Úwrapper  s
    z_logged_cached.<locals>.wrapper)Ú	functoolsÚpartialÚ_logged_cachedÚwraps)rI   rJ   rL   r   )rH   rI   rJ   rK   r   rO   û   s    	rO   Ú	_ExecInfozexecutable versionc             C   sú  d*dd„}| dkr"|ddgddƒS | d	kr†t jd
kr@dddd	gnd	g}x2|D ]*}y||dgddƒS  tk
rt   Y qLX qLW tdƒ‚�np| dkrœ|ddgdƒS | dk�r„d}t jd
k�r`ddl}d}xfd|j|jgD ]T}y8|j|jdd|j|B ƒ�}|j	|dƒd }W dQ R X W qÒ t
k
�r$   Y qÒX qÒW |�rdx2d+D ]$} t|| ƒ}	|	jƒ �r6t|	ƒ}P �q6W nd}|dk�rvtdƒ‚||dgdƒS | dk�rè|dd gd!d"d#�}
|
�räd$|
jk�pÌd%|
j  k�oÈd&kn   �rätd'|
j› d(�ƒ‚|
S td)j| ƒƒ‚dS ),a   
    Get the version of some executable that Matplotlib optionally depends on.

    .. warning:
       The list of executables that this function supports is set according to
       Matplotlib's internal needs, and may change without notice.

    Parameters
    ----------
    name : str
        The executable to query.  The following values are currently supported:
        "dvipng", "gs", "inkscape", "magick", "pdftops".  This list is subject
        to change without notice.

    Returns
    -------
    If the executable is found, a namedtuple with fields ``executable`` (`str`)
    and ``version`` (`distutils.version.LooseVersion`, or ``None`` if the
    version cannot be determined).

    Raises
    ------
    FileNotFoundError
        If the executable is not found or older than the oldest version
        supported by Matplotlib.
    ValueError
        If the executable is not one that we know how to query.
    NFc             S   sÐ   yt j| t jdd�}W n4 t jk
rJ } z|r6|j}n|‚W Y d d }~X nX tj||ƒ}|r¨t|jdƒƒ}|d k	rš||k ršt	d| d › d|› d|› d�ƒ‚t
| d |ƒS t	d	| d › d
dj| ƒ› d|› �ƒ‚d S )NT)ÚstderrÚuniversal_newlinesr	   z	You have r   z	 version z4 but the minimum version supported by Matplotlib is Ú.z#Failed to determine the version of z from ú z, which output )Ú
subprocessÚcheck_outputÚSTDOUTÚCalledProcessErrorÚoutputÚreÚsearchr   ÚgroupÚFileNotFoundErrorrQ   Újoin)ÚargsÚregexZmin_verÚignore_exit_coderZ   Z_cpeÚmatchr   r   r   r   Úimpl<  s     z"_get_executable_info.<locals>.implÚdvipngz-versionz(?m)^dvipng(?: .*)? (.+)z1.6ÚgsÚwin32Úgswin32cÚgswin64cÚmgsz	--versionz(.*)Ú9z)Failed to find a Ghostscript installationÚinkscapez-Vz^Inkscape ([^ ]*)Zmagickr   r0   zSoftware\Imagemagick\CurrentZBinPathúconvert.exeú
magick.exeÚconvertz*Failed to find an ImageMagick installationz^Version: ImageMagick (\S*)Úpdftopsz-vz^pdftops version (.*)T)rb   z3.0z0.9z1.0zYou have pdftops version z8 but the minimum version supported by Matplotlib is 3.0.zUnknown executable: {!r})NF)rm   rn   )ÚsysÚplatformr^   ÚwinregZKEY_WOW64_32KEYZKEY_WOW64_64KEYÚ	OpenKeyExÚHKEY_LOCAL_MACHINEZKEY_QUERY_VALUEÚQueryValueExÚOSErrorr   ÚexistsÚstrr   Ú
ValueErrorr5   )Únamerd   ZexecsÚeÚpathrs   ZbinpathÚflagÚhkeyÚ	candidateÚinfor   r   r   Ú_get_executable_info  s`    











 r‚   ú3.1c              C   sh   yHt jddgt jt jd�} | jƒ \}}|jdƒjdƒd }|jƒ d }|S  tttfk
rb   d S X d S )Nre   z-version)ÚstdoutrR   r   Ú
r	   éÿÿÿÿ)	rV   ÚPopenÚPIPEÚcommunicater   ÚsplitÚ
IndexErrorrz   rw   )Úsr„   rR   ÚlineÚvr   r   r   Úcheckdep_dvipng�  s    

r�   c              C   s¸   t jd kr¬tjdkr"ddddg} ndg} x‚| D ]z}yZtj|dgtjtjd�}|jƒ \}}|jdkrŠ|d d… j	d
ƒ}t
|dƒrŠ|t _|t _W q. tttfk
r¦   Y q.X q.W t jt jfS )Nrg   rh   ri   rj   rf   z	--version)r„   rR   r   r	   r   z9.0r†   )Úcheckdep_ghostscriptÚ
executablerq   rr   rV   r‡   rˆ   r‰   Ú
returncoder   r    r   r‹   rz   rw   )Zgs_execsZgs_execrŒ   r„   rR   rŽ   r   r   r   r�   �  s$    








r�   c              C   s|   yZt jddgt jt jd�} | jƒ \}}|jdƒjdƒ}x |D ]}d|kr<|jƒ d }q<W |S  tttt	fk
rv   d S X d S )	Nrp   z-v)r„   rR   r   r…   r   r	   r†   )
rV   r‡   rˆ   r‰   r   rŠ   r‹   rz   ÚUnboundLocalErrorrw   )rŒ   r„   rR   Úlinesr�   rŽ   r   r   r   Úcheckdep_pdftops·  s    

r•   c              C   s�   t jd krŠybtjddgtjtjd�} | jƒ \}}|jdƒjdƒ}x"|D ]}d|krF|jƒ d }P qFW |t _W n tt	t
tfk
rˆ   Y nX t jS )Nrl   z-V)r„   rR   r   r…   ZInkscaper	   )Úcheckdep_inkscaper   rV   r‡   rˆ   r‰   r   rŠ   r‹   rz   r“   rw   )rŒ   r„   rR   r”   r�   rŽ   r   r   r   r–   Æ  s    




r–   c             C   sl   | sdS yt dƒ W n tk
r2   tjdƒ dS X | dkrhyt dƒ W n tk
rf   tjdƒ dS X | S )NFrf   z9Setting rcParams['ps.usedistiller'] requires ghostscript.Zxpdfrp   z<Setting rcParams['ps.usedistiller'] to 'xpdf' requires xpdf.)r‚   r^   r?   Úwarning)rŒ   r   r   r   Úcheckdep_ps_distillerÚ  s     r˜   c             C   s|   | sdS t jdƒs tjdƒ dS ytdƒ W n tk
rJ   tjdƒ dS X ytdƒ W n tk
rv   tjdƒ dS X dS )	NFZtexzusetex mode requires TeX.re   zusetex mode requires dvipng.rf   z!usetex mode requires ghostscript.T)ÚshutilÚwhichr?   r—   r‚   r^   )rŒ   r   r   r   Úcheckdep_usetexí  s     



r›   z$HOME=%sc               C   s&   yt tjƒ ƒS  tk
r    dS X dS )zk
    Return the user's home directory.

    If the user's home directory cannot be found, return None.
    N)ry   r   ÚhomeÚ	Exceptionr   r   r   r   Úget_home   s    rž   c              C   s(   t jdd� } tjd< tjtj| ƒ | S )zU
    If the config or cache directory cannot be created, create a temporary one.
    zmatplotlib-)ÚprefixÚMPLCONFIGDIR)ÚtempfileÚmkdtempÚosÚenvironÚatexitÚregisterr™   Úrmtree)Ú	configdirr   r   r   Ú_create_tmp_config_or_cache_dir  s    r©   c               C   s&   t jjdƒp$tƒ r"tttƒ dƒƒS dS )z¯
    Return the XDG configuration directory, according to the `XDG
    base directory spec
    <http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html>`_.
    ÚXDG_CONFIG_HOMEz.configN)r£   r¤   Úgetrž   ry   r   r   r   r   r   Ú_get_xdg_config_dir  s    r¬   c               C   s&   t jjdƒp$tƒ r"tttƒ dƒƒS dS )z§
    Return the XDG cache directory, according to the `XDG
    base directory spec
    <http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html>`_.
    ÚXDG_CACHE_HOMEz.cacheN)r£   r¤   r«   rž   ry   r   r   r   r   r   Ú_get_xdg_cache_dir#  s    r®   c             C   s¦   t jjdƒ}|rt|ƒjƒ }n4tjjdƒr:| r:t| dƒ}ntƒ rNttƒ dƒ}nd }|r y|j	ddd� W n t
k
r|   Y n$X t jt|ƒt jƒr |jƒ r t|ƒS tƒ S )	Nr    ÚlinuxÚfreebsdÚ
matplotlibz.matplotlibT)ÚparentsÚexist_ok)r¯   r°   )r£   r¤   r«   r   Úresolverq   rr   Ú
startswithrž   Úmkdirrw   Úaccessry   ÚW_OKÚis_dirr©   )Zxdg_baser¨   r   r   r   Ú_get_config_or_cache_dir/  s     rº   zCONFIGDIR=%sc               C   s
   t tƒ ƒS )a�  
    Return the string representing the configuration directory.

    The directory is chosen as follows:

    1. If the MPLCONFIGDIR environment variable is supplied, choose that.
    2a. On Linux, follow the XDG specification and look first in
        `$XDG_CONFIG_HOME`, if defined, or `$HOME/.config`.
    2b. On other platforms, choose `$HOME/.matplotlib`.
    3. If the chosen directory exists and is writable, use that as the
       configuration directory.
    4. If possible, create a temporary directory, and use it as the
       configuration directory.
    5. A writable directory could not be found or created; return None.
    )rº   r¬   r   r   r   r   Úget_configdirF  s    r»   zCACHEDIR=%sc               C   s
   t tƒ ƒS )z¾
    Return the location of the cache directory.

    The procedure used to find the directory is the same as for
    _get_config_dir, except using `$XDG_CACHE_HOME`/`~/.cache` instead.
    )rº   r®   r   r   r   r   Úget_cachedirZ  s    r¼   c              C   sp   dt jkr<t jd } t jj| ƒs(tdƒ‚tjdddd� | S dd„ }x|ƒ D ]} | jƒ rLt| ƒS qLW tdƒ‚d	S )
zget the path to matplotlib dataZMATPLOTLIBDATAz2Path in environment MATPLOTLIBDATA not a directoryz3.1zenvironment variable)r{   Úobj_typec              s   sv   t tƒjdƒV  dd l} t | jjƒjdƒV  ttdd ƒrrt tjƒjdƒV  t tjƒjjdƒV  t tj	d ƒd V  d S )Nzmpl-datar   Úfrozen)
r   Ú__file__Z	with_nameZmatplotlib.afmZafmÚgetattrrq   r‘   Úparentr}   )r±   r   r   r   Úget_candidate_pathsq  s    z+_get_data_path.<locals>.get_candidate_pathsz(Could not find the matplotlib data filesN)	r£   r¤   r}   ÚisdirÚRuntimeErrorr
   r   r¹   ry   )r}   rÂ   r   r   r   Ú_get_data_pathe  s    

rÅ   zmatplotlib data path: %sc               C   s*   t d d d krtƒ t d d< t d d S )NÚdatapathr   )r   rÅ   r   r   r   r   Úget_data_path†  s    rÇ   c              C   sZ   t tƒ ƒ} i }x>tt j| jdƒƒD ](}|jt|jj| jƒƒg ƒj	t|ƒƒ q"W t
|jƒ ƒS )Nz**/*)r   rÇ   ÚfilterÚis_fileÚglobÚ
setdefaultry   rÁ   Zrelative_toÚappendÚlistÚitems)Z	data_pathÚdr}   r   r   r   Úget_py2exe_datafiles�  s    
rÐ   c              C   sB   dd„ } x,| ƒ D ]"}t jj|ƒrt jj|ƒ r|S qW tdƒ‚dS )až  
    Get the location of the config file.

    The file location is determined in the following order

    - ``$PWD/matplotlibrc``
    - ``$MATPLOTLIBRC`` if it is not a directory
    - ``$MATPLOTLIBRC/matplotlibrc``
    - ``$MPLCONFIGDIR/matplotlibrc``
    - On Linux,
        - ``$XDG_CONFIG_HOME/matplotlib/matplotlibrc`` (if ``$XDG_CONFIG_HOME``
          is defined)
        - or ``$HOME/.config/matplotlib/matplotlibrc`` (if ``$XDG_CONFIG_HOME``
          is not defined)
    - On other platforms,
        - ``$HOME/.matplotlib/matplotlibrc`` if ``$HOME`` is defined
    - Lastly, it looks in ``$MATPLOTLIBDATA/matplotlibrc``, which should always
      exist.
    c              s   sv   t jjt jƒ dƒV  yt jd } W n tk
r6   Y nX | V  t jj| dƒV  t jjtƒ dƒV  t jjtƒ dƒV  d S )NÚmatplotlibrcZMATPLOTLIBRC)r£   r}   r_   Úgetcwdr¤   ÚKeyErrorr»   rÇ   )rÑ   r   r   r   Úgen_candidates¬  s    z(matplotlib_fname.<locals>.gen_candidateszCCould not find matplotlibrc file; your Matplotlib install is brokenN)r£   r}   rx   rÃ   rÄ   )rÔ   Úfnamer   r   r   Úmatplotlib_fname—  s
    rÖ   z	pgf.debugú3.0)ztext.latex.unicodezsavefig.frameonzverbose.fileozverbose.levelc               @   sØ   e Zd ZdZdd„ ejƒ D ƒZejdƒe	dd„ ƒƒZ
ejdƒe	dd„ ƒƒZejdƒe	d	d
„ ƒƒZejdƒe	dd„ ƒƒZejdƒe	dd„ ƒƒZdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd „ Zd!S )"ÚRcParamsz›
    A dictionary object including validation

    validating functions are defined and associated with rc parameters in
    :mod:`matplotlib.rcsetup`
    c             C   s"   i | ]\}\}}|t kr||“qS r   )Ú_all_deprecated)Ú.0ÚkeyÚdefaultÚ	converterr   r   r   ú
<dictcomp>á  s   
zRcParams.<dictcomp>z3.0c             C   s   dS )Nz=%s is deprecated and replaced with %s; please use the latter.r   )Úselfr   r   r   Úmsg_deprå  s    zRcParams.msg_deprc             C   s   dS )Nz-%s is deprecated and ignored. Use %s instead.r   )rß   r   r   r   Úmsg_depr_ignoreê  s    zRcParams.msg_depr_ignorec             C   s   dS )NzM%s is deprecated. Please remove it from your matplotlibrc and/or style files.r   )rß   r   r   r   Úmsg_depr_setï  s    zRcParams.msg_depr_setc             C   s   dS )NzK%s is obsolete. Please remove it from your matplotlibrc and/or style files.r   )rß   r   r   r   Úmsg_obsoleteõ  s    zRcParams.msg_obsoletec             C   s   dS )Nz¬The {} rcParam was deprecated in version 2.2.  In order to force the use of a specific Qt binding, either import that binding first, or set the QT_API environment variable.r   )rß   r   r   r   Úmsg_backend_obsoleteû  s    zRcParams.msg_backend_obsoletec             O   s   | j ||Ž d S )N)Úupdate)rß   r`   Úkwargsr   r   r   Ú__init__  s    zRcParams.__init__c       	      C   sR  �y&|t kr<t | \}}}}tj||d|d� |}||ƒ}n�|tkrh|d k	rht| \}tj||dd� nd|tkr’t| \}}tj||d|d� d S |dkr®tjd|ddd� n|dkrÌ|tjkrÌd| krÌd S y| j| |ƒ}W n8 tk
�r } ztd	|t	|ƒf ƒ‚W Y d d }~X nX t
j| ||ƒ W n$ tk
�rL   t|› d
�ƒ‚Y nX d S )NÚrcparam)r{   r½   Úalternative)r{   r½   zexamples.directoryz3.0zKIn the future, examples will be found relative to the 'datapath' directory.)r{   r½   ÚaddendumÚbackendz
Key %s: %szQ is not a valid rc parameter (see rcParams.keys() for a list of valid parameters))Ú_deprecated_mapr
   r   Ú_deprecated_remain_as_noneÚ_deprecated_ignore_mapr   Ú_auto_backend_sentinelÚvalidaterz   ry   ÚdictÚ__setitem__rÓ   )	rß   rÛ   Úvalr   Úalt_keyÚalt_valÚinverse_altÚcvalÚver   r   r   rò     s>    


&zRcParams.__setitem__c             C   sÒ   |t kr:t | \}}}}tj||d|d� |tj| |ƒƒS |tkrtt| \}}tj||d|d� |rptj| |ƒS d S |dkr�tjd|ddd� n6|dkrÆtj| |ƒ}|tjkrÆdd	lm	} |j
tjƒ tj| |ƒS )
Nrè   )r{   r½   ré   zexamples.directoryz3.0zKIn the future, examples will be found relative to the 'datapath' directory.)r{   r½   rê   rë   r   )Úpyplot)rì   r
   r   rñ   Ú__getitem__rî   r   rï   r±   rù   Úswitch_backend)rß   rÛ   r   rô   rõ   rö   ró   Zpltr   r   r   rú   *  s&    
zRcParams.__getitem__c             C   sP   | j j}t|ƒd }tjt| ƒdd| d�jdƒ}dd|  j|ƒ}dj||ƒS )Nr	   éP   )ÚindentÚwidthr…   rU   z{}({}))	Ú	__class__Ú__name__ÚlenÚpprintÚpformatrñ   rŠ   r_   r5   )rß   Ú
class_namerý   Z
repr_splitZrepr_indentedr   r   r   Ú__repr__D  s    zRcParams.__repr__c             C   s   dj tdjt| jƒ ƒƒƒS )Nr…   z{0[0]}: {0[1]})r_   Úmapr5   ÚsortedrÎ   )rß   r   r   r   Ú__str__L  s    zRcParams.__str__c          
   c   s,   t jƒ � ttj| ƒƒE dH  W dQ R X dS )zYield sorted list of keys.N)r
   Ú(_suppress_matplotlib_deprecation_warningr  rñ   Ú__iter__)rß   r   r   r   r
  O  s    
zRcParams.__iter__c             C   s
   t j| ƒS )N)rñ   Ú__len__)rß   r   r   r   r  T  s    zRcParams.__len__c                s$   t j|ƒ‰ t‡ fdd„| jƒ D ƒƒS )a  
        Return the subset of this RcParams dictionary whose keys match,
        using :func:`re.search`, the given ``pattern``.

        .. note::

            Changes to the returned dictionary are *not* propagated to
            the parent RcParams dictionary.

        c             3   s$   | ]\}}ˆ j |ƒr||fV  qd S )N)r\   )rÚ   rÛ   Úvalue)Ú
pattern_rer   r   ú	<genexpr>c  s   z$RcParams.find_all.<locals>.<genexpr>)r[   ÚcompilerØ   rÎ   )rß   Úpatternr   )r  r   Úfind_allW  s    
zRcParams.find_allc                s   ‡ fdd„ˆ D ƒS )Nc                s   i | ]}t jˆ |ƒ|“qS r   )rñ   rú   )rÚ   Úk)rß   r   r   rÞ   h  s    z!RcParams.copy.<locals>.<dictcomp>r   )rß   r   )rß   r   Úcopyg  s    zRcParams.copyN)r   Ú
__module__Ú__qualname__Ú__doc__r   rÎ   rð   r
   Ú
deprecatedÚpropertyrà   rá   râ   rã   rä   rç   rò   rú   r  r  r
  r  r  r  r   r   r   r   rØ   Ø  s,   $rØ   Fc             C   s   t tƒ | ƒS )z\Return a :class:`matplotlib.RcParams` instance from the
    default matplotlib rc file.
    )Úrc_params_from_filerÖ   )Úfail_on_errorr   r   r   Ú	rc_paramsk  s    r  z'http://|https://|ftp://|file://|file:\\c             C   s   t j| ƒdk	S )z8Return True if string is an http, ftp, or file URL path.N)Ú	URL_REGEXrc   )Úfilenamer   r   r   Úis_urlu  s    r  c          	   c   s€   t | ƒr:dd l}|jj| ƒ�}dd„ |D ƒV  W d Q R X nBtjj| ƒ} tjdd�}|d kr^d}t	| |d��}|V  W d Q R X d S )Nr   c             s   s   | ]}|j d ƒV  qdS )zutf-8N)r   )rÚ   r�   r   r   r   r    s    z$_open_file_or_url.<locals>.<genexpr>F)Údo_setlocalezutf-8)Úencoding)
r  Úurllib.requestÚrequestÚurlopenr£   r}   Ú
expanduserÚlocaleÚgetpreferredencodingÚopen)rÕ   ÚurllibÚfr   r   r   r   Ú_open_file_or_urlz  s    r*  zline #%d
	"%s"
	in file "%s"c          !   C   sÈ  d}i }t | ƒ�Ü}y¤xž|D ]–}|d7 }|jddƒd jƒ }|s@q|jddƒ}t|ƒdkrtt||| f }tjd|ƒ q|\}	}
|	jƒ }	|
jƒ }
|	|kr¢tjd| |ƒ |
||f||	< qW W n0 tk
ræ   tjd| tj	d	d
�pÜdƒ ‚ Y nX W dQ R X t
ƒ }xÊ|jƒ D ]¾\}	\}
}}|	tk�r||�r*|
||	< nPy|
||	< W nB tk
�rx } z$t||| f }tjd|
||ƒ W Y dd}~X nX nB|	tk�r¦t|	 \}}tj||	|dd� ntd|	|| f tjd� �qW |S )zèReturn :class:`matplotlib.RcParams` from the contents of the given file.

    Unlike `rc_params_from_file`, the configuration class only contains the
    parameters specified in the file (i.e. default values are not filled in).
    r   r	   ú#ú:é   z
Illegal %sz"Duplicate key in file %r line #%d.zTCannot decode configuration file %s with encoding %s, check LANG and LC_* variables.F)r  zutf-8 (default)NzBad val %r on %s
	%sz Please update your matplotlibrc.)r{   ré   rê   zÏ
Bad key "%s" on line %d in
%s.
You probably need to get an updated matplotlibrc file from
http://github.com/matplotlib/matplotlib/blob/master/matplotlibrc.template
or from the matplotlib source distribution)Úfile)r*  rŠ   Ústripr  Ú_error_details_fmtr?   r—   ÚUnicodeDecodeErrorr%  r&  rØ   rÎ   r   r�   rî   r
   r   Úprintrq   rR   )rÕ   r  ZcntZrc_tempÚfdr�   ÚstrippedlineÚtupZerror_detailsrÛ   ró   ÚconfigÚmsgr   rô   r   r   r   Ú_rc_params_in_fileŒ  s^    





r8  Tc             C   s”   t | |ƒ}|s|S tjƒ }tjƒ � tdd„ |D ƒƒ}W dQ R X |j|ƒ |d dkr`tƒ |d< dj|d ƒr„t	j
ddj|d ƒƒ t	jd	| ƒ |S )
a  Return :class:`matplotlib.RcParams` from the contents of the given file.

    Parameters
    ----------
    fname : str
        Name of file parsed for matplotlib settings.
    fail_on_error : bool
        If True, raise an error when the parser fails to convert a parameter.
    use_default_template : bool
        If True, initialize with default parameters before updating with those
        in the given file. If False, the configuration class only contains the
        parameters specified in the file. (Useful for updating dicts.)
    c             S   s$   g | ]\}\}}|t kr||f‘qS r   )rÙ   )rÚ   rÛ   rÜ   Ú_r   r   r   ú
<listcomp>â  s    
z'rc_params_from_file.<locals>.<listcomp>NrÆ   r0   ztext.latex.preamblea
  
*****************************************************************
You have the following UNSUPPORTED LaTeX preamble customizations:
%s
Please do not ask for support with these customizations active.
*****************************************************************
r…   zloaded rc file %s)r8  r   rÎ   r
   r	  rØ   rå   rÇ   r_   r?   r�   rG   )rÕ   r  Úuse_default_templateZconfig_from_fileZiter_paramsr6  r   r   r   r  Í  s    



r  zexamples.directoryc             C   s$   g | ]\}\}}|t kr||f‘qS r   )rÙ   )rÚ   rÛ   rÜ   rÝ   r   r   r   r:    s    
r:  zps.usedistillerzaxes.formatter.use_localer0   c             K   sš   ddddddddœ}t | tƒr$| f} xp| D ]h}xb|jƒ D ]V\}}|j|ƒpL|}d	||f }y|t|< W q8 tk
rŒ   td
|||f ƒ‚Y q8X q8W q*W dS )aà  
    Set the current rc params.  *group* is the grouping for the rc, e.g.,
    for ``lines.linewidth`` the group is ``lines``, for
    ``axes.facecolor``, the group is ``axes``, and so on.  Group may
    also be a list or tuple of group names, e.g., (*xtick*, *ytick*).
    *kwargs* is a dictionary attribute name/value pairs, e.g.,::

      rc('lines', linewidth=2, color='r')

    sets the current rc params and is equivalent to::

      rcParams['lines.linewidth'] = 2
      rcParams['lines.color'] = 'r'

    The following aliases are available to save typing for interactive
    users:

    =====   =================
    Alias   Property
    =====   =================
    'lw'    'linewidth'
    'ls'    'linestyle'
    'c'     'color'
    'fc'    'facecolor'
    'ec'    'edgecolor'
    'mew'   'markeredgewidth'
    'aa'    'antialiased'
    =====   =================

    Thus you could abbreviate the above rc command as::

          rc('lines', lw=2, c='r')


    Note you can use python's kwargs dictionary facility to store
    dictionaries of default parameters.  e.g., you can customize the
    font rc as follows::

      font = {'family' : 'monospace',
              'weight' : 'bold',
              'size'   : 'larger'}

      rc('font', **font)  # pass in the font dict as kwargs

    This enables you to easily switch between several configurations.  Use
    ``matplotlib.style.use('default')`` or :func:`~matplotlib.rcdefaults` to
    restore the default rc params after changes.
    Z	linewidthZ	linestyleÚcolorZ	facecolorZ	edgecolorZmarkeredgewidthZantialiased)ZlwZlsÚcZfcZecZmewZaaz%s.%sz2Unrecognized key "%s" for group "%s" and name "%s"N)r   ry   rÎ   r«   ÚrcParamsrÓ   )r]   ræ   ÚaliasesÚgr  rŽ   r{   rÛ   r   r   r   Úrc  s$    3

rA  c                  sH   t jƒ �6 ddlm‰  tjƒ  tj‡ fdd„tjƒ D ƒƒ W dQ R X dS )a·  
    Restore the rc params from Matplotlib's internal default style.

    Style-blacklisted rc params (defined in
    `matplotlib.style.core.STYLE_BLACKLIST`) are not updated.

    See Also
    --------
    rc_file_defaults
        Restore the rc params from the rc file originally loaded by Matplotlib.
    matplotlib.style.use :
        Use a specific style file.  Call ``style.use('default')`` to restore
        the default style.
    r	   )ÚSTYLE_BLACKLISTc                s   i | ]\}}|ˆ kr||“qS r   r   )rÚ   r  rŽ   )rB  r   r   rÞ   s  s    zrcdefaults.<locals>.<dictcomp>N)	r
   r	  Ú
style.corerB  r>  Úclearrå   ÚrcParamsDefaultrÎ   r   r   )rB  r   Ú
rcdefaults_  s    
rF  c                  s<   t jƒ �* ddlm‰  tj‡ fdd„tD ƒƒ W dQ R X dS )zº
    Restore the rc params from the original rc file loaded by Matplotlib.

    Style-blacklisted rc params (defined in
    `matplotlib.style.core.STYLE_BLACKLIST`) are not updated.
    r	   )rB  c                s   i | ]}|ˆ krt | |“qS r   )ÚrcParamsOrig)rÚ   r  )rB  r   r   rÞ   ‚  s    z$rc_file_defaults.<locals>.<dictcomp>N)r
   r	  rC  rB  r>  rå   rG  r   r   )rB  r   Úrc_file_defaultsw  s    	
rH  )r;  c               sJ   t jƒ �8 ddlm‰  t| |d�‰tj‡ ‡fdd„ˆD ƒƒ W dQ R X dS )að  
    Update rc params from file.

    Style-blacklisted rc params (defined in
    `matplotlib.style.core.STYLE_BLACKLIST`) are not updated.

    Parameters
    ----------
    fname : str
        Name of file parsed for matplotlib settings.

    use_default_template : bool
        If True, initialize with default parameters before updating with those
        in the given file. If False, the current configuration persists
        and only the parameters specified in the file are updated.

    r	   )rB  )r;  c                s   i | ]}|ˆ krˆ| |“qS r   r   )rÚ   r  )rB  Úrc_from_filer   r   rÞ   ž  s    zrc_file.<locals>.<dictcomp>N)r
   r	  rC  rB  r  r>  rå   )rÕ   r;  r   )rB  rI  r   Úrc_file†  s
    

rJ  c               @   s2   e Zd ZdZddd„Zdd„ Zdd„ Zd	d
„ ZdS )Ú
rc_contexta¿  
    Return a context manager for managing rc settings.

    This allows one to do::

        with mpl.rc_context(fname='screen.rc'):
            plt.plot(x, a)
            with mpl.rc_context(fname='print.rc'):
                plt.plot(x, b)
            plt.plot(x, c)

    The 'a' vs 'x' and 'c' vs 'x' plots would have settings from
    'screen.rc', while the 'b' vs 'x' plot would have settings from
    'print.rc'.

    A dictionary can also be passed to the context manager::

        with mpl.rc_context(rc={'text.usetex': True}, fname='screen.rc'):
            plt.plot(x, a)

    The 'rc' dictionary takes precedence over the settings loaded from
    'fname'.  Passing a dictionary only is also valid. For example a
    common usage is::

        with mpl.rc_context(rc={'interactive': False}):
            fig, ax = plt.subplots()
            ax.plot(range(3), range(3))
            fig.savefig('A.png', format='png')
            plt.close(fig)
    Nc             C   sL   t jƒ | _y|rt|ƒ |r&t j|ƒ W n tk
rF   | jƒ  ‚ Y nX d S )N)r>  r  Ú_origrJ  rå   r�   Ú_rc_context__fallback)rß   rA  rÕ   r   r   r   rç   É  s    
zrc_context.__init__c             C   s4   | j d }tjt| j ƒ | j d tjkr0|td< d S )Nrë   )rL  rñ   rå   r>  r   rï   )rß   Zupdated_backendr   r   r   Z
__fallbackÔ  s    
zrc_context.__fallbackc             C   s   | S )Nr   )rß   r   r   r   Ú	__enter__Ý  s    zrc_context.__enter__c             C   s   | j ƒ  d S )N)rM  )rß   Úexc_typeÚ	exc_valueÚexc_tbr   r   r   Ú__exit__à  s    zrc_context.__exit__)NN)r   r  r  r  rç   rM  rN  rR  r   r   r   r   rK  ¢  s
   	
	rK  Úargrë   c             C   sf   t | ƒ}tjtdƒ|krnHdtjkrR| r8|r8tjdƒ |rbddlm	} ||ƒ n| td< t
d< dS )a+  
    Select the backend used for rendering and GUI integration.

    Parameters
    ----------
    backend : str
        The backend to switch to.  This can either be one of the standard
        backend names, which are case-insensitive:

        - interactive backends:
          GTK3Agg, GTK3Cairo, MacOSX, nbAgg,
          Qt4Agg, Qt4Cairo, Qt5Agg, Qt5Cairo,
          TkAgg, TkCairo, WebAgg, WX, WXAgg, WXCairo

        - non-interactive backends:
          agg, cairo, pdf, pgf, ps, svg, template

        or a string of the form: ``module://my.module.name``.

    warn : bool, optional, default: False
        If True and not *force*, warn that the call will have no effect if
        this is called after pyplot has been imported and a backend is set up.


    force : bool, optional, default: True
        If True, attempt to switch the backend.   An ImportError is raised if
        an interactive backend is selected, but another interactive
        backend has already started.

    See Also
    --------
    :ref:`backends`
    matplotlib.get_backend
    rë   zmatplotlib.pyplotzKmatplotlib.pyplot has already been imported, this call will have no effect.r   )rû   N)r   rñ   rú   r>  rq   Úmodulesr
   Z_warn_externalZmatplotlib.pyplotrû   rE  )rë   ÚwarnÚforcer{   rû   r   r   r   Úuseä  s    $


rW  Z
MPLBACKENDc               C   s   t d S )z_
    Return the name of the current backend.

    See Also
    --------
    matplotlib.use
    rë   )r>  r   r   r   r   Úget_backend*  s    rX  c             C   s   | t d< dS )zz
    Set interactive mode to boolean b.

    If b is True, then draw after every plotting command, e.g., after xlabel
    ÚinteractiveN)r>  )r   r   r   r   rY  5  s    rY  c               C   s   t d S )z'Return true if plot mode is interactiverY  )r>  r   r   r   r   Úis_interactive>  s    rZ  zrcParams['tk.window_focus'])ré   c               C   s   t d dkrdS t d S )zÃReturn true if focus maintenance under TkAgg on win32 is on.
     This currently works only for python.exe and IPython.exe.
     Both IDLE and Pythonwin.exe fail badly when tk_window_focus is on.rë   ZTkAggFztk.window_focus)r>  r   r   r   r   Útk_window_focusC  s    r[  zmatplotlib.testszmatplotlib.sphinxext.testszmpl_toolkits.testsc              C   sÀ   dd l } tj dko6dtj  k o&dk n  o6| jƒ dksHdd l}|jƒ  d}ddlm} |j|ksl|j	d	kr�t
jd
j||j|j	d	krˆdndƒƒ ydd l}W n tk
rº   tdƒ ‚ Y nX d S )Nr   rg   r   é   é   ÚCPythonz2.6.1)r!   Úlocala  Matplotlib is not built with the correct FreeType version to run tests.  Set local_freetype=True in setup.cfg and rebuild. Expect many image comparison failures below. Expected freetype version {0}. Found freetype version {1}. Freetype build type is {2}localr0   znot z'matplotlib.test requires pytest to run.)r   r\  )r   r\  r]  )rr   rq   Úversion_infoÚpython_implementationÚfaulthandlerÚenabler±   r!   Z__freetype_version__Z__freetype_build_type__r?   r—   r5   Úpytestr4   r2  )rr   rb  ZLOCAL_FREETYPE_VERSIONr!   rd  r   r   r   Ú_init_testsT  s(    


re  c                s.  t ƒ  tjjtjjtjjtƒdƒƒs,tdƒ‚tƒ }t	j
ƒ }zÂtdƒ |rRt	j|ƒ ddl}|jdg ƒ}d}	d}
x>|D ]6‰ t‡ fdd	„tD ƒƒr”d
}	P tjjˆ ƒrtd
}	d
}
P qtW |
r¼|dg7 }|	rÈ|t7 }|rÖ|dg7 }| rì|dd|   g7 }|j|f|Ž}W d|jƒ dk�rt||d� |�r(t	j|ƒ X |S )zRun the matplotlib test suite.Útestsz%Matplotlib test data is not installedZaggr   Nr9   Tc             3   s   | ]}ˆ j |ƒV  qd S )N)rµ   )rÚ   Úmodule_path)rS  r   r   r  ‹  s   ztest.<locals>.<genexpr>Fz--pyargsz--covú-rŽ   )rU  )re  r£   r}   rÃ   r_   Údirnamer¿   r4   rX  rq   ÚgetrecursionlimitrW  Úsetrecursionlimitrd  ÚpopÚanyÚdefault_test_modulesrx   ÚmainÚlower)Ú	verbosityZcoverageZswitch_backend_warnZrecursionlimitræ   Zold_backendZold_recursionlimitrd  r`   Zprovide_default_modulesZ
use_pyargsÚretcoder   )rS  r   Útestx  sH    




rs  c             C   s4   yt |tƒr| | }W n tk
r*   Y nX t|ƒS )zd
    Either returns ``data[value]`` or passes ``data`` back, converts either to
    a sequence.
    )r   ry   r�   r   )Údatar  r   r   r   Ú	_replacer«  s    
ru  c             C   s.   y| j S  tk
r(   t|tƒr$|S Y nX d S )N)r{   ÚAttributeErrorr   ry   )ÚyÚdefault_namer   r   r   Ú_label_from_arg»  s    

ry  z

Notes
-----
aa  

.. note::
    In addition to the above described arguments, this function can take a
    **data** keyword argument. If such a **data** argument is given, the
    following arguments are replaced by **data[<arg>]**:

    {replaced}

    Objects passed as **data** must support item access (``data[<arg>]``) and
    membership test (``<arg> in data``).
c             C   sp   | dk	rt j| ƒnd} |dkr"dn(t|ƒdkr2dndjdjttt|ƒƒƒƒ}tj|d�}t	| krht	| }| | S )aÃ  Add documentation for a *data* field to the given docstring.

    Parameters
    ----------
    docstring : str
        The input docstring.
    replace_names : list of str or None
        The list of parameter names which arguments should be replaced by
        ``data[name]`` (if ``data[name]`` does not throw an exception).  If
        None, replacement is attempted for all arguments.

    Returns
    -------
        The augmented docstring.
    Nr0   z+* All positional and all keyword arguments.r   z-* All arguments with the following names: {}.z, )Zreplaced)
ÚinspectÚcleandocr  r5   r_   r  Úreprr  Ú_DATA_DOC_APPENDIXÚ_DATA_DOC_TITLE)Z	docstringÚreplace_namesÚreplrê   r   r   r   Ú_add_data_docØ  s    r�  )r  Úlabel_namerc         	      s`  ˆdkrt jtˆˆd�S tjˆƒ}d‰d‰g ‰ t|jjƒ ƒ}x@|D ]8}|jt	j
krZ|j‰qB|jt	jkrn|j‰qBˆ j|jƒ qBW t	dt	jdd�}ˆr |jd|ƒ n
|j|ƒ |j|d�‰ˆ dd… ‰ ˆdk	rÒtˆƒ‰ˆpÚtƒ tˆ ƒksúˆsútdjˆˆjƒƒ‚ˆdk�s ˆˆ k�s tdjˆˆjƒƒ‚t jˆƒdd	œ‡ ‡‡‡‡‡‡fd
d„
ƒ}t|jˆƒ|_ˆ|_|S )aœ  
    A decorator to add a 'data' kwarg to a function.

    ::
        @_preprocess_data()
        def func(ax, *args, **kwargs): ...

    is a function with signature ``decorated(ax, *args, data=None, **kwargs)``
    with the following behavior:

    - if called with ``data=None``, forward the other arguments to ``func``;
    - otherwise, *data* must be a mapping; for any argument passed in as a
      string ``name``, replace the argument by ``data[name]`` (if this does not
      throw an exception), then forward the arguments to ``func``.

    In either case, any argument that is a `MappingView` is also converted to a
    list.

    Parameters
    ----------
    replace_names : list of str or None, optional, default: None
        The list of parameter names for which lookup into *data* should be
        attempted. If None, replacement is attempted for all arguments.
    label_namer : string, optional, default: None
        If set e.g. to "namer" (which must be a kwarg in the function's
        signature -- not as ``**kwargs``), if the *namer* argument passed in is
        a (string) key of *data* and no *label* kwarg is passed, then use the
        (string) value of the *namer* as *label*. ::

            @_preprocess_data(label_namer="foo")
            def func(foo, label=None): ...

            func("key", data={"key": value})
            # is equivalent to
            func.__wrapped__(value, label="key")
    N)r  r‚  rt  )rÜ   r	   )Ú
parametersz@Matplotlib internal error: invalid replace_names ({!r}) for {!r}z>Matplotlib internal error: invalid label_namer ({!r}) for {!r})rt  c               s’  ˆ d krˆ| ft t|ƒž|ŽS ˆj| f|ž|Ž}ˆoFd|jkoFd|jk}|jjˆƒp^|jjˆƒ}x¢|jjƒ D ]”\}}|ˆkr²x‚|jƒ D ]&\}	}
ˆd ksž|	ˆkr†tˆ |
ƒ||	< q†W ql|ˆkràˆd krÞt‡ fdd„|D ƒƒ|j|< qlˆd ksð|ˆkrltˆ |ƒ|j|< qlW |j	ƒ  |jd= |�r„|j|j–}t
|ˆ |ƒ}dˆk�rr||jd< y|jjˆƒ W n tk
�rn   Y nX n||jjˆi ƒd< ˆ|j|jŽS )NÚlabelc             3   s   | ]}t ˆ |ƒV  qd S )N)ru  )rÚ   Úv1)rt  r   r   r  Q  s    z2_preprocess_data.<locals>.inner.<locals>.<genexpr>rt  )r  r   ÚbindÚ	argumentsræ   r«   rÎ   ru  ÚtupleÚapply_defaultsry  Úmove_to_endrÓ   rË   r`   )Zaxrt  r`   ræ   ÚboundZneeds_labelZ
auto_labelr  rŽ   Zk1r…  Z
all_kwargsr„  )Ú	arg_namesrJ   r‚  Únew_sigr  Úvarargs_nameÚvarkwargs_name)rt  r   Úinner>  s>    



z_preprocess_data.<locals>.innerr†   )rM   rN   Ú_preprocess_datarz  Ú	signaturerÍ   rƒ  ÚvaluesÚkindr   ÚVAR_POSITIONALr{   ÚVAR_KEYWORDrÌ   ÚKEYWORD_ONLYÚinsertÚreplaceÚsetÚAssertionErrorr5   r   rP   r�  r  Ú__signature__)rJ   r  r‚  ÚsigÚparamsÚpZ
data_paramr�  r   )rŒ  rJ   r‚  r�  r  rŽ  r�  r   r‘  õ  sD    &



 *r‘  zmatplotlib version %szinteractive is %szplatform is %szloaded modules: %s)r   r   )N)r×   N)r×   )rƒ   )rƒ   )rƒ   )F)F)FT)FT)NFTr   )N)‰r  rq   r`  r4   r¥   Úcollectionsr   Úcollections.abcr   Ú
contextlibZdistutils.versionr   rM   r1   rz  r   r%  r:   r£   Zpathlibr   r  r[   r™   rV   r¡   r0   r
   r   Zmatplotlib.cbookr   r   r   r   r   Zmatplotlib.rcsetupr   r   r   r'   Ú_versionr   ry   r3   Ú	getLoggerr   r?   Z
__bibtex__r    r8   Úhasattrr9   Ú	lru_cacherB   rF   rO   rQ   r‚   r  r�   r�   r‘   r   r•   r–   r˜   r›   rž   r©   r¬   r®   rº   r»   r¼   rÅ   rÇ   rÐ   rÖ   rì   rî   rí   rÙ   rñ   rØ   r  r  r  r  Úcontextmanagerr*  r0  r8  r  r>  rú   r}   ÚisabsrŠ   Z_basedirÚ_fnameÚrealpathr_   Z	_fullpathr	  r  rG  rÎ   rE  Ú	setlocaleÚLC_ALLrA  rF  rH  rJ  rK  Z_rename_parameterrW  r¤   r«   rX  rY  rZ  r[  rn  re  rs  Z__test__ru  ry  r~  r}  r�  r‘  rG   rr   rÍ   rT  r   r   r   r   Ú<module>e   sö   



r
!
+ 


A
*

IBA	$ 
/y