B
    ]”t\Cú  ã            	   @   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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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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 /e0¡Z1dZ2dZ3dd„ Z4yddl5Z5W n ek
r‚   edƒ‚Y nX yddl6Z6W n ek
r®   edƒ‚Y nX e4e6j.dƒsÌede6j. ƒ‚e4e*j.e2ƒsìede2e*j.f ƒ‚e7edƒs dge_8dZ9d”dd„Z:dd „ Z;e;ƒ  G d!d"„ d"e<ƒZ=e >¡  e ?d#¡ e=ƒ Z@W dQ R X d•d$d%„ZAd&d'„ ZBd(d)„ ZCdeC_DdeC_Ed*d+„ ZFd,d-„ ZGdeG_Ed.d/„ ZHd0d1„ ZIeAd2ƒd3d4„ ƒZJd5d6„ ZKd7d8„ ZLd9d:„ ZMd;d<„ ZNeAd=ƒd>d?„ ƒZOeAd@ƒdAdB„ ƒZPdCdD„ ZQeAdEƒdFdG„ ƒZRdHdI„ ZSdJdK„ ZTi ZUdLdMdNdOdPœZVdQdRdRdSdTœZWeUeV™ZXG dUdV„ dVeeYƒZZd–dXdY„Z[e \dZ¡Z]d[d\„ Z^ej_d]d^„ ƒZ`d_Zad—d`da„Zbd˜dcdd„Zce[ƒ ZdeY eedde¡rîejf gedde ¡sîejf heTƒ ¡\ZiZjejf kei¡Ziejf leiedde ¡Zmemedde< e >¡ 4 e ?d#e!¡ eZed n¡ ƒZoeZdfdg„ e' p¡ D ƒƒZqW dQ R X eHeddh ƒeddh< eIeddi ƒeddi< eddj rhe rejsdk¡ dldm„ Ztdndo„ Zudpdq„ Zvdrds„ ZwG dtdu„ duƒZxd™dvdw„Zyejz {dx¡r¾ejz {dx¡eddy< dzd{„ Z|d|d}„ Z}d~d„ Z~d€d„ Zd‚dƒd„gZ€d…d†„ Zdšd‡dˆ„Z‚dWe‚_ƒd‰dŠ„ Z„d‹Z…dŒd„ Z†d›dŽd„Z‡e1 ˆde.¡ e1 ˆd‘e~ƒ ¡ e1 ˆd’ej‰¡ e1 ˆ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

)ÚMutableMapping)Ú	Parameter)ÚPathé   )ÚcbookÚrcsetup)ÚMatplotlibDeprecationWarningÚdedentÚ	get_labelÚsanitize_sequence)ÚmplDeprecation)ÚdefaultParamsÚvalidate_backendÚcycler)Úget_versionsÚversionz1.10.0aì  @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   sl   t | tƒr t dd¡ |  d¡} t |tƒr@t dd¡ | d¡}| rdtj | ¡} tj |¡}| |kS dS dS )z.return True if a is greater than or equal to bz3.0z)compare_version arguments should be strs.ÚasciiFN)Ú
isinstanceÚbytesr   Úwarn_deprecatedÚdecodeÚ	distutilsr   ZLooseVersion)ÚaÚb© r   ú2lib/python3.7/site-packages/matplotlib/__init__.pyÚcompare_versions¯   s    



r   zMatplotlib requires dateutilzMatplotlib requires pyparsingz2.0.1z1Matplotlib requires pyparsing>=2.0.1; you have %sz*Matplotlib requires numpy>=%s; you have %sÚargvZ	modpythona+  matplotlib.verbose is deprecated;
Command line argument --verbose-LEVEL is deprecated.
This functionality is now provided by the standard
python logging library.  To get more (or less) logging output:
    import logging
    logger = logging.getLogger('matplotlib')
    logger.set_level(logging.INFO)Úsilentú
sys.stdoutc             C   s¼   t jt jt jt jt jt jdœ}||  }t ¡ }||k r¸t |¡ tjtj	dœ}||kr`|| }n:tj}yt
|dƒ}W n$ tk
r˜   t d |¡¡ Y nX t  |¡}| |¡ t |¡ dS )z@
    Use a --verbose-LEVEL level to set the logging level:

    )r    ÚhelpfulÚdebugzdebug-annoyingÚinfoÚwarning)z
sys.stdoutz
sys.stderrÚwzBcould not open log file "{0}"for writing.  Check your matplotlibrcN)ÚloggingZWARNINGÚINFOÚDEBUGÚ_logZgetEffectiveLevelZsetLevelÚsysÚstdoutÚstderrÚopenÚIOErrorÚwarningsÚwarnÚformatZStreamHandlerZ
addHandler)Ú	level_strZfile_strZlevelmapZnewlevZoldlevÚstdÚfileoZconsoler   r   r   Ú_set_logger_verbose_levelæ   s(    




r6   c              C   sF   d} x<t jdd… D ]*}| d¡r|dd… }|| krt|ƒ qW dS )zh
    Check for --verbose-LEVEL type command line arguments and
    set logging level appropriately.
    )r    r"   r#   zdebug-annoyingr$   r%   r   Nz
--verbose-é
   )r+   r   Ú
startswithr6   )ÚlevelsÚargr3   r   r   r   Ú_parse_commandline	  s    
r;   c               @   sî   e Zd ZdZdZdd„ eeƒD ƒZdZx:ej	dd… D ](Z
e
 d¡sFq6e
dd… Zeekr6eZq6W ejd	ed
dd„ ƒZejd	ed
dd„ ƒZejd	ed
dd„ ƒZejd	ed
ddd„ƒZejd	ed
ddd„ƒZejd	ed
dd„ ƒZdS )ÚVerbosez…
    A class to handle reporting.  Set the fileo attribute to any file
    instance to handle the output.  Default is sys.stdout
    )r    r"   r#   zdebug-annoyingc             C   s   i | ]\}}||“qS r   r   )Ú.0ÚiÚlevelr   r   r   ú
<dictcomp>$  s    zVerbose.<dictcomp>Nr   z
--verbose-r7   z2.2)Úmessagec             C   s   |   d¡ tj| _d S )Nr    )Ú	set_levelr+   r,   r5   )Úselfr   r   r   Ú__init__4  s    
zVerbose.__init__c             C   s:   | j dk	r| j }|| jkr0t d|| jf ¡ n|| _dS )z6set the verbosity to one of the Verbose.levels stringsNzEmatplotlib: unrecognized --verbose-* string "%s". Legal values are %s)Ú_commandLineVerboser9   r0   r1   r?   )rC   r?   r   r   r   rB   9  s    

zVerbose.set_levelc             C   s^   t jt jdœ}||kr"|| | _n8yt|dƒ}W n" tk
rR   td |¡ƒ‚Y nX || _d S )N)z
sys.stdoutz
sys.stderrr&   zgVerbose object could not open log file "{0}" for writing.
Check your matplotlibrc verbose.fileo setting)r+   r,   r-   r5   r.   r/   Ú
ValueErrorr2   )rC   Úfnamer4   r5   r   r   r   Ú	set_fileoE  s    
zVerbose.set_fileor"   c             C   s    |   |¡rt|| jd dS dS )zƒ
        print message s to self.fileo if self.level>=level.  Return
        value indicates whether a message was issued

        )ÚfileTF)ÚgeÚprintr5   )rC   Úsr?   r   r   r   ÚreportW  s    
zVerbose.reportTc                s4   t ˆƒst‚‡ ‡‡‡‡‡fdd„‰dˆ_ˆjˆ_ˆS )a8  
        return a callable function that wraps func and reports it
        output through the verbose handler if current verbosity level
        is higher than level

        if always is True, the report will occur on every function
        call; otherwise only on the first time the function is called
        c                 s4   ˆ| |Ž}ˆ sˆj s0ˆ ˆ| ˆ¡}ˆj s0|ˆ_ |S )N)Ú_spokerM   )ÚargsÚkwargsÚretZspoke)ÚalwaysÚfmtÚfuncr?   rC   Úwrapperr   r   rU   o  s    

zVerbose.wrap.<locals>.wrapperF)ÚcallableÚAssertionErrorrN   Ú__doc__)rC   rS   rT   r?   rR   r   )rR   rS   rT   r?   rC   rU   r   Úwrapc  s
    
zVerbose.wrapc             C   s   | j | j | j | kS )z%return true if self.level is >= level)Úvaldr?   )rC   r?   r   r   r   rJ   {  s    z
Verbose.ge)r"   )r"   T)Ú__name__Ú
__module__Ú__qualname__rX   r9   Ú	enumeraterZ   rE   r+   r   r:   r8   r3   r   Ú
deprecatedÚ_verbose_msgrD   rB   rH   rM   rY   rJ   r   r   r   r   r<     s$   
r<   Úignorec                s<   ˆdkrt  tˆ¡S d‰ d‰t  ˆ¡‡ ‡‡‡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  ˆˆ¡ ˆS )NT)r*   r#   r   )ÚcalledrS   rT   rQ   r   r   rU   ™  s
    z_logged_cached.<locals>.wrapper)Ú	functoolsÚpartialÚ_logged_cachedÚwraps)rS   rT   rU   r   )rb   rS   rT   rQ   r   re   †  s    	re   c           
   C   sh   yHt jddgt jt jd} |  ¡ \}}| d¡ d¡d }| ¡ d }|S  tttfk
rb   d S X d S )NZdvipngz-version)r,   r-   r   Ú
r   éÿÿÿÿ)	Ú
subprocessÚPopenÚPIPEÚcommunicater   ÚsplitÚ
IndexErrorrF   ÚOSError)rL   r,   r-   ÚlineÚvr   r   r   Úcheckdep_dvipng¥  s    

rr   c              C   s®   t jd kr¢tjdkr"ddddg} ndg} xx| D ]p}yPtj|dgtjtjd}| ¡ \}}|jdkr€|d d	…  	d
¡}|t _|t _
W q. tttfk
rœ   Y q.X q.W t jt j
fS )NÚwin32Zgswin32cZgswin64cZmgsZgsz	--version)r,   r-   r   rh   r   )Úcheckdep_ghostscriptÚ
executabler+   Úplatformri   rj   rk   rl   Ú
returncoder   r   rn   rF   ro   )Zgs_execsÚgs_execrL   r,   r-   rq   r   r   r   rt   ²  s"    







rt   c              C   s|   yZt jddgt jt jd} |  ¡ \}}| d¡ d¡}x |D ]}d|kr<| ¡ d }q<W |S  tttt	fk
rv   d S X d S )NZpdftopsz-v)r,   r-   r   rg   r   rh   )
ri   rj   rk   rl   r   rm   rn   rF   ÚUnboundLocalErrorro   )rL   r,   r-   Úlinesrp   rq   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} |  ¡ \}}| d¡ d¡}x"|D ]}d|krF| ¡ d }P qFW |t _W n tt	t
tfk
rˆ   Y nX t jS )NZinkscapez-V)r,   r-   r   rg   ZInkscaper   )Úcheckdep_inkscaper   ri   rj   rk   rl   r   rm   rn   rF   ry   ro   )rL   r,   r-   rz   rp   rq   r   r   r   r|   Ø  s    




r|   c             C   s   | sdS d}d}t ƒ \}}t||ƒs6d}t d| ¡ | dkr€d}d}tƒ }t||ƒrXn(t||ƒrnt|dƒsnnd}t d	| ¡ |rˆ| S dS d S )
NFTz8.60znmatplotlibrc ps.usedistiller option can not be used unless ghostscript-%s or later is installed on your systemZxpdfz3.0z0.9z1.0zgmatplotlibrc ps.usedistiller can not be set to xpdf unless xpdf-%s or later is installed on your system)rt   r   r0   r1   r{   )rL   ÚflagÚgs_reqrx   Úgs_vZpdftops_reqZpdftops_req_altZ	pdftops_vr   r   r   Úcheckdep_ps_distillerë  s0    




r€   c             C   s|   | sdS d}d}d}t  d¡d kr0d}t d¡ tƒ }t||ƒsRd}t d| ¡ tƒ \}}t||ƒsxd}t d| ¡ |S )	NFz9.00z1.6TZtexzVmatplotlibrc text.usetex option can not be used unless TeX is installed on your systemzpmatplotlibrc text.usetex can not be used with *Agg backend unless dvipng-%s or later is installed on your systemzcmatplotlibrc text.usetex can not be used unless ghostscript-%s or later is installed on your system)ÚshutilZwhichr0   r1   rr   r   rt   )rL   r~   Z
dvipng_reqr}   Zdvipng_vrx   r   r   r   r   Úcheckdep_usetex  s&    



r‚   z$HOME=%sc               C   s&   yt t ¡ ƒ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)Ústrr   ÚhomeÚ	Exceptionr   r   r   r   Úget_home+  s    r†   c              C   s(   t jdd } tjd< t tj| ¡ | S )zS
    If the config directory can not be created, create a temporary directory.
    zmatplotlib-)ÚprefixÚMPLCONFIGDIR)ÚtempfileZmkdtempÚosÚenvironÚatexitÚregisterr   Zrmtree)Ú	configdirr   r   r   Ú_create_tmp_config_dir8  s    r   c               C   s&   t j d¡p$tƒ r"tttƒ dƒƒS dS )z°
    Returns the XDG configuration directory, according to the `XDG
    base directory spec
    <http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html>`_.
    ZXDG_CONFIG_HOMEz.configN)rŠ   r‹   Úgetr†   rƒ   r   r   r   r   r   Ú_get_xdg_config_dirB  s    r‘   c               C   s&   t j d¡p$tƒ r"tttƒ dƒƒS dS )z¨
    Returns the XDG cache directory, according to the `XDG
    base directory spec
    <http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html>`_.
    ZXDG_CACHE_HOMEz.cacheN)rŠ   r‹   r   r†   rƒ   r   r   r   r   r   Ú_get_xdg_cache_dirN  s    r’   c             C   s¦   t j d¡}|rt|ƒ ¡ }n4t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  t|ƒt j¡r | ¡ r t|ƒS tƒ S )Nrˆ   )ZlinuxZfreebsdÚ
matplotlibz.matplotlibT)ÚparentsÚexist_ok)rŠ   r‹   r   r   Zresolver+   rv   r8   r†   Úmkdirro   Úaccessrƒ   ÚW_OKÚis_dirr   )Zxdg_baserŽ   r   r   r   Ú_get_config_or_cache_dirZ  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_configdirq  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_cachedir…  s    rœ   c              C   s`   dt jkr,t jd } t j | ¡s(tdƒ‚| S dd„ }x|ƒ D ]} |  ¡ r<t| ƒS q<W tdƒ‚dS )zget the path to matplotlib dataZMATPLOTLIBDATAz2Path in environment MATPLOTLIBDATA not a directoryc              s   sv   t tƒ d¡V  dd l} t | jjƒ d¡V  ttdd ƒrrt tjƒ d¡V  t tjƒj d¡V  t tj	d ƒd V  d S )Nzmpl-datar   Úfrozen)
r   Ú__file__Z	with_nameZmatplotlib.afmZafmÚgetattrr+   ru   ÚparentÚpath)r“   r   r   r   Úget_candidate_pathsš  s    z+_get_data_path.<locals>.get_candidate_pathsz(Could not find the matplotlib data filesN)rŠ   r‹   r¡   ÚisdirÚRuntimeErrorr™   rƒ   )r¡   r¢   r   r   r   Ú_get_data_path  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|  d¡ƒD ](}| t|j | j¡ƒg ¡ 	t|ƒ¡ q"W t
| ¡ ƒS )Nz**/*)r   r§   ÚfilterÚis_fileZglobÚ
setdefaultrƒ   r    Zrelative_toÚappendÚlistÚitems)Z	data_pathÚdr¡   r   r   r   Úget_py2exe_datafiles¶  s    
r¯   c              C   sJ   dd„ } x<| ƒ D ]2}t j |¡rt  |¡j}t |¡s@t |¡rP qW |S )aØ  
    Get the location of the config file.

    The file location is determined in the following order

    - `$PWD/matplotlibrc`

    - `$MATPLOTLIBRC` if it is a file (or a named pipe, which can be created
      e.g. by process substitution)

    - `$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` for a
      system-defined copy.
    c              s   sv   t j t  ¡ d¡V  yt jd } W n tk
r6   Y nX | V  t j | d¡V  t j tƒ d¡V  t j tƒ d¡V  d S )NÚmatplotlibrcZMATPLOTLIBRC)rŠ   r¡   ÚjoinÚgetcwdr‹   ÚKeyErrorr›   r§   )r°   r   r   r   Úgen_candidatesÞ  s    z(matplotlib_fname.<locals>.gen_candidates)rŠ   r¡   ÚexistsÚstatÚst_modeÚS_ISREGÚS_ISFIFO)r´   rG   r·   r   r   r   Úmatplotlib_fname¿  s    rº   )z2.1N)z2.2zfigure.facecolor)z2.2N)z3.0N)ztext.dvipnghackznbagg.transparentzplugins.directoryz	pgf.debug)z2.1)z2.2)z3.0)z	axes.holdzbackend.qt4zbackend.qt5ztext.latex.unicodec               @   sØ   e Zd ZdZdd„ e ¡ D ƒZee 	d¡dd„ ƒƒZ
ee 	d¡dd„ ƒƒZee 	d¡d	d
„ ƒƒZee 	d¡dd„ ƒƒZee 	d¡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)r=   ÚkeyÚdefaultÚ	converterr   r   r   r@     s   
zRcParams.<dictcomp>z3.0c             C   s   dS )Nz=%s is deprecated and replaced with %s; please use the latter.r   )rC   r   r   r   Úmsg_depr  s    zRcParams.msg_deprc             C   s   dS )Nz-%s is deprecated and ignored. Use %s instead.r   )rC   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   )rC   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   )rC   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   )rC   r   r   r   Úmsg_backend_obsolete2  s    zRcParams.msg_backend_obsoletec             O   s   | j ||Ž d S )N)Úupdate)rC   rO   rP   r   r   r   rD   :  s    zRcParams.__init__c       
   
   C   sf  y:|t kr<t | \}}}}tj||d|d |}||ƒ}n¤|tkr||d k	r|t| \}d}| d¡rhd}tjd|d|d nd|tkr¦t| \}}tj||d|d d S |d	krÂt 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 d d }	~	X Y nX t | ||¡ W n$ tk
r`   td|f ƒ‚Y nX d S )NÚrcparam)Úobj_typeÚalternativeÚ Úbackendz}In order to force the use of a specific Qt binding, either import that binding first, or set the QT_API environment variable.z2.2)ÚnamerÇ   Úaddendum)rË   rÇ   rÈ   zexamples.directoryz3.0z]{} is deprecated; in the future, examples will be found relative to the 'datapath' directory.z
Key %s: %szS%s is not a valid rc parameter. See rcParams.keys() for a list of valid parameters.)Ú_deprecated_mapr   r   Ú_deprecated_remain_as_noner8   Ú_deprecated_ignore_mapr2   r	   Ú_auto_backend_sentinelÚvalidaterF   rƒ   ÚdictÚ__setitem__r³   )
rC   r½   Úvalr   Úalt_keyÚalt_valÚinverse_altrÌ   ZcvalZver   r   r   rÓ   =  sH    




&zRcParams.__setitem__c             C   sÒ   |t kr:t | \}}}}tj||d|d |t | |¡ƒS |tkrtt| \}}tj||d|d |rpt | |¡S d S |dkrt dd |¡¡ n6|dkrÆt | |¡}|tjkrÆddl	m
} | tj¡ t | |¡S )	NrÆ   )rÇ   rÈ   zexamples.directoryz3.0z]{} is deprecated; in the future, examples will be found relative to the 'datapath' directory.rÊ   r   )Úpyplot)rÍ   r   r   rÒ   Ú__getitem__rÏ   r2   r	   rÐ   r“   rØ   Úswitch_backend)rC   r½   r   rÕ   rÖ   r×   rÔ   Zpltr   r   r   rÙ   f  s(    

zRcParams.__getitem__c             C   sP   | j j}t|ƒd }tjt| ƒdd| d d¡}dd|   |¡}d ||¡S )Nr   éP   )ÚindentÚwidthrg   ú z{}({}))	Ú	__class__r[   ÚlenÚpprintZpformatrÒ   rm   r±   r2   )rC   Ú
class_namerÜ   Z
repr_splitZrepr_indentedr   r   r   Ú__repr__€  s    zRcParams.__repr__c             C   s   d  tdjt|  ¡ ƒƒ¡S )Nrg   z{0[0]}: {0[1]})r±   Úmapr2   Úsortedr­   )rC   r   r   r   Ú__str__ˆ  s    zRcParams.__str__c          	   c   s8   t  ¡ & t  dt¡ tt | ¡ƒE dH  W dQ R X dS )zYield sorted list of keys.ra   N)r0   Úcatch_warningsÚsimplefilterr
   rå   rÒ   Ú__iter__)rC   r   r   r   ré   ‹  s    
zRcParams.__iter__c             C   s
   t  | ¡S )N)rÒ   Ú__len__)rC   r   r   r   rê   ‘  s    zRcParams.__len__c                s$   t  |¡‰ t‡ fdd„|  ¡ 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$   | ]\}}ˆ   |¡r||fV  qd S )N)Úsearch)r=   r½   Úvalue)Ú
pattern_rer   r   ú	<genexpr>   s   z$RcParams.find_all.<locals>.<genexpr>)ÚreÚcompiler»   r­   )rC   Úpatternr   )rí   r   Úfind_all”  s    
zRcParams.find_allc                s   ‡ fdd„ˆ D ƒS )Nc                s   i | ]}t  ˆ |¡|“qS r   )rÒ   rÙ   )r=   Úk)rC   r   r   r@   ¥  s    z!RcParams.copy.<locals>.<dictcomp>r   )rC   r   )rC   r   Úcopy¤  s    zRcParams.copyN)r[   r\   r]   rX   r   r­   rÑ   Úpropertyr   r_   rÀ   rÁ   rÂ   rÃ   rÄ   rD   rÓ   rÙ   rã   ræ   ré   rê   rò   rô   r   r   r   r   r»     s,   )r»   Fc             C   sD   t ƒ }tj |¡s:d}tdd„ t ¡ D ƒƒ}t |¡ |S t	|| ƒS )z\Return a :class:`matplotlib.RcParams` instance from the
    default matplotlib rc file.
    z*could not find rc file; returning defaultsc             S   s$   g | ]\}\}}|t kr||f‘qS r   )r¼   )r=   r½   r¾   Ú_r   r   r   ú
<listcomp>°  s    
zrc_params.<locals>.<listcomp>)
rº   rŠ   r¡   rµ   r»   r   r­   r0   r1   Úrc_params_from_file)Úfail_on_errorrG   rA   rQ   r   r   r   Ú	rc_params¨  s    
rú   z'http://|https://|ftp://|file://|file:\\c             C   s   t  | ¡dk	S )z8Return True if string is an http, ftp, or file URL path.N)Ú	URL_REGEXÚmatch)Úfilenamer   r   r   Úis_url¼  s    rþ   c          	   c   sx   t | ƒr2tj | ¡}dd„ |D ƒV  W d Q R X nBtj | ¡} tjdd}|d krVd}t	| |d}|V  W d Q R X d S )Nc             s   s   | ]}|  d ¡V  qdS )zutf-8N)r   )r=   rp   r   r   r   rî   Å  s    z$_open_file_or_url.<locals>.<genexpr>F)Údo_setlocalezutf-8)Úencoding)
rþ   ÚurllibZrequestZurlopenrŠ   r¡   Ú
expanduserÚlocaleÚgetpreferredencodingr.   )rG   Úfr   r   r   r   Ú_open_file_or_urlÁ  s    r  zline #%d
	"%s"
	in file "%s"c             C   sd  d}i }t | ƒæ}yªx¤|D ]œ}|d7 }| dd¡d  ¡ }|s@q| dd¡}t|ƒdkrvt||| f }t d| ¡ q|\}	}
|	 ¡ }	|
 ¡ }
|	|kr¨t d| |f ¡ |
||f||	< qW W n4 tk
rð   t d| tj	d	d
pâdf ¡ ‚ Y nX W dQ R X t
ƒ }xŒdD ]„}	|	|kr| |	¡\}
}}|r6|
||	< nTy|
||	< W nF tk
rˆ } z&t||| f }t d|
||f ¡ W dd}~X Y nX qW xÎ| ¡ D ]Â\}	\}
}}|	tkr|rÂ|
||	< nTy|
||	< W nF tk
r } z&t||| f }t d|
||f ¡ W dd}~X Y nX nB|	tkrBt|	 \}}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 "%s", line #%dzSCannot decode configuration file %s with encoding %s, check LANG and LC_* variablesF)rÿ   zutf-8 (default)N)zverbose.levelzverbose.fileozBad val "%s" on %s
	%sz Please update your matplotlibrc.)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)rI   )r  rm   Ústriprà   Ú_error_details_fmtr0   r1   ÚUnicodeDecodeErrorr  r  r»   Úpopr…   r­   r   rÏ   r   r   rK   r+   r-   )rG   rù   ZcntZrc_tempÚfdrp   ZstrippedlineÚtupZerror_detailsr½   rÔ   ÚconfigÚmsgr   rÕ   r   r   r   Ú_rc_params_in_fileÒ  st    





&

"

r  Tc          	   C   s    t | |ƒ}|s|S t ¡ }t ¡ $ t dt¡ tdd„ |D ƒƒ}W dQ R X | |¡ |d dkrlt	ƒ |d< d 
|d ¡rt dd	 
|d ¡¡ t 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.)
    ra   c             S   s$   g | ]\}\}}|t kr||f‘qS r   )r¼   )r=   r½   r¾   rö   r   r   r   r÷   6  s    
z'rc_params_from_file.<locals>.<listcomp>Nr¦   rÉ   ztext.latex.preamblea
  
*****************************************************************
You have the following UNSUPPORTED LaTeX preamble customizations:
%s
Please do not ask for support with these customizations active.
*****************************************************************
rg   zloaded rc file %s)r  r   r­   r0   rç   rè   r
   r»   rÅ   r§   r±   r*   r$   r#   )rG   rù   Zuse_default_templateZconfig_from_fileZiter_paramsr  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text.usetexzaxes.formatter.use_localerÉ   c          
   K   sš   ddddddddœ}t | tƒr$| f} xp| D ]h}xb| ¡ D ]V\}}| |¡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	linestyleZ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   rƒ   r­   r   ÚrcParamsr³   )ÚgrouprP   ÚaliasesÚgró   rq   rË   r½   r   r   r   Úrcm  s$    3

r  c            	      sT   t  ¡ B t  dt¡ ddlm‰  t ¡  t ‡ fdd„t	 
¡ 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.
    ra   r   )ÚSTYLE_BLACKLISTc                s   i | ]\}}|ˆ kr||“qS r   r   )r=   ró   rq   )r  r   r   r@   Ë  s    zrcdefaults.<locals>.<dictcomp>N)r0   rç   rè   r   Ú
style.corer  r  ÚclearrÅ   ÚrcParamsDefaultr­   r   r   )r  r   Ú
rcdefaults¶  s
    
r  c            	      sH   t  ¡ 6 t  dt¡ ddlm‰  t ‡ 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.
    ra   r   )r  c                s   i | ]}|ˆ krt | |“qS r   )ÚrcParamsOrig)r=   ró   )r  r   r   r@   Û  s    z$rc_file_defaults.<locals>.<dictcomp>N)	r0   rç   rè   r   r  r  r  rÅ   r  r   r   )r  r   Úrc_file_defaultsÏ  s    	
r  c          	      sR   t  ¡ @ t  dt¡ ddlm‰  t| ƒ‰t ‡ ‡fdd„ˆD ƒ¡ W dQ R X dS )z
    Update rc params from file.

    Style-blacklisted rc params (defined in
    `matplotlib.style.core.STYLE_BLACKLIST`) are not updated.
    ra   r   )r  c                s   i | ]}|ˆ krˆ| |“qS r   r   )r=   ró   )r  Úrc_from_filer   r   r@   ì  s    zrc_file.<locals>.<dictcomp>N)	r0   rç   rè   r   r  r  rø   r  rÅ   )rG   r   )r  r   r   Úrc_fileß  s
    	
r!  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  ¡ | _y|rt|ƒ |r&t  |¡ W n tk
rF   |  ¡  ‚ Y nX d S )N)r  rô   Ú_origr!  rÅ   r…   Ú_rc_context__fallback)rC   r  rG   r   r   r   rD     s    
zrc_context.__init__c             C   s4   | j d }t t| j ¡ | j d tjkr0|td< d S )NrÊ   )r#  rÒ   rÅ   r  r	   rÐ   )rC   Zupdated_backendr   r   r   Z
__fallback"  s    
zrc_context.__fallbackc             C   s   | S )Nr   )rC   r   r   r   Ú	__enter__+  s    zrc_context.__enter__c             C   s   |   ¡  d S )N)r$  )rC   Úexc_typeÚ	exc_valueZexc_tbr   r   r   Ú__exit__.  s    zrc_context.__exit__)NN)r[   r\   r]   rX   rD   r$  r%  r(  r   r   r   r   r"  ð  s
   	
	r"  c             C   sh   t | ƒ}t td¡|krnJdtjkrT|s:|r:tjddd |rdddlm	} ||ƒ n| td< t
d< dS )	a.  
    Set the matplotlib backend to one of the known backends.

    Parameters
    ----------
    arg : str
        The backend to switch to.  This can either be one of the
        'standard' backend names:

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

        Note: Standard backend names are case-insensitive here.

    warn : bool, optional
        If True, warn if this is called after pyplot has been imported
        and a backend is set up.

        defaults to False.

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

    See Also
    --------
    :ref:`backends`
    matplotlib.get_backend
    rÊ   zmatplotlib.pyplotzJmatplotlib.pyplot as already been imported, this call will have no effect.r	  )Ú
stacklevelr   )rÚ   N)r   rÒ   rÙ   r  r+   Úmodulesr0   r1   Zmatplotlib.pyplotrÚ   r  )r:   r1   ZforcerË   rÚ   r   r   r   Úuse2  s    &

r+  Z
MPLBACKENDrÊ   c               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    r,  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   r-  ‡  s    r-  c               C   s   t d S )z'Return true if plot mode is interactiver-  )r  r   r   r   r   Úis_interactive  s    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_focus•  s    r/  zmatplotlib.testszmatplotlib.sphinxext.testszmpl_toolkits.testsc              C   sÀ   dd l } tj dkr8dtj  k r(dk r8n n|  ¡ dksHdd l}| ¡  d}ddlm} |j|ksl|j	dkrt
 d	 ||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   rs   )r   é   )r   r0  é   ZCPythonz2.6.1)Úft2fontZ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}localrÉ   znot z'matplotlib.test requires pytest to run.)rv   r+   Úversion_infoZpython_implementationÚfaulthandlerÚenabler“   r2  Z__freetype_version__Z__freetype_build_type__r0   r1   r2   ÚpytestÚImportErrorrK   )rv   r4  ZLOCAL_FREETYPE_VERSIONr2  r6  r   r   r   Ú_init_tests¥  s(    


r8  c          
      s.  t ƒ  tj tj tj t¡d¡¡s,tdƒ‚tƒ }t	 
¡ }zÂtdƒ |rRt	 |¡ ddl}| dg ¡}d}	d}
x>|D ]6‰ t‡ fdd	„tD ƒƒr”d
}	P t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| ¡ dkrt||d |r(t	 |¡ X |S )zrun the matplotlib test suiteZtestsz%Matplotlib test data is not installedZaggr   Nr   Tc             3   s   | ]}ˆ   |¡V  qd S )N)r8   )r=   Zmodule_path)r:   r   r   rî   Þ  s   ztest.<locals>.<genexpr>Fz--pyargsz--covú-rq   )r1   )r8  rŠ   r¡   r£   r±   Údirnamerž   r7  r,  r+   Úgetrecursionlimitr+  Úsetrecursionlimitr6  r  ÚanyÚdefault_test_modulesrµ   ÚmainÚlower)Ú	verbosityZcoverageZswitch_backend_warnZrecursionlimitrP   Zold_backendZold_recursionlimitr6  rO   Zprovide_default_modulesZ
use_pyargsZretcoder   )r:   r   ÚtestË  sH    




rB  c             C   s4   t |tƒs|S yt| | ƒS  tk
r.   |S X dS )zhEither returns data[key] or passes data back. Also
    converts input data to a sequence as needed.
    N)r   rƒ   r   r³   )Údatar½   r   r   r   Ú	_replacerþ  s    
rD  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   sj   | dkrd} nt | ƒ} d}|dkr(d}n2t|ƒdkr8d}|rD|d7 }|jd t|ƒ¡d}| tj|d	 S )
a$  Add documentation for a *data* field to the given docstring.

    Parameters
    ----------
    docstring : str
        The input docstring.
    replace_names : list of strings or None
        The list of parameter names which arguments should be replaced by
        `data[name]`. If None, all arguments are replaced if they are
        included in `data`.
    replace_all_args : bool
        If True, all arguments in *args get replaced, even if they are not
        in replace_names.

    Returns
    -------
        The augmented docstring.
    NrÉ   z+* All positional and all keyword arguments.r   z4* All arguments with the following names: '{names}'.z 
    * All positional arguments.z', ')Únames)Zreplaced)r   rà   r2   r±   rå   Ú_DATA_DOC_APPENDIX)Z	docstringÚreplace_namesÚreplace_all_argsZ_replr   r   r   Ú_add_data_doc  s    rI  c                s&   ˆdk	rt ˆƒ‰‡ ‡‡‡fdd„}|S )aÔ  
    A decorator to add a 'data' kwarg to any a function.  The signature
    of the input function must include the ax argument at the first position ::

       def foo(ax, *args, **kwargs)

    so this is suitable for use with Axes methods.

    Parameters
    ----------
    replace_names : list of strings, optional, default: None
        The list of parameter names which arguments should be replaced by
        `data[name]`. If None, all arguments are replaced if they are
        included in `data`.
    replace_all_args : bool, default: False
        If True, all arguments in *args get replaced, even if they are not
        in replace_names.
    label_namer : string, optional, default: None
        The name of the parameter which argument should be used as label, if
        label is not set. If None, the label keyword argument is not set.
    positional_parameter_names : list of strings or callable, optional
        The full list of positional parameter names (excluding an explicit
        `ax`/'self' argument at the first place and including all possible
        positional parameter in `*args`), in the right order. Can also include
        all other keyword parameter. Only needed if the wrapped function does
        contain `*args` and (replace_names is not None or replace_all_args is
        False). If it is a callable, it will be called with the actual
        tuple of *args and the data and should return a list like
        above.
        NOTE: callables should only be used when the names and order of *args
        can only be determined at runtime. Please use list of names
        when the order and names of *args is clear before runtime!

    .. note:: decorator also converts MappingView input data to list.
    Nc       
         s,  t  ˆ¡}d}d}g }t|j ¡ ƒ}x<|D ]4}|jtjkr@d}q*|jtjkrRd}q*| 	|j
¡ q*W tdtjd d}|r„| d|¡ n
| 	|¡ |j|d}d‰|s°|dd … ‰ n¶ˆd kr¾d ‰ n¨tˆƒdkrÐg ‰ n–t|ƒdkr&ˆd kr&tˆt|dd … ƒ ƒdkr|dd … ‰ ntd	 ˆj¡ƒ‚n@ˆd k	rJtˆƒrDd‰g ‰ nˆ‰ nˆrVg ‰ ntd
 ˆj¡ƒ‚d‰d‰ˆr¢ˆ r¢ˆˆ kr¢ˆ  ˆ¡‰dˆ kr¢ˆ  d¡‰ˆræˆsæ|sæˆ sÊtd ˆ¡ƒ‚nˆˆ krætd ˆˆ ¡ƒ‚n t ˆ¡d dœ‡ ‡‡‡‡‡‡‡‡f	dd„
ƒ}	t|	jˆˆƒ|	_||	_|	S )NFTrC  )r¾   rh   )Ú
parametersr   r   zeGot unknown 'replace_names' and wrapped function {!r} uses '*args', need 'positional_parameter_names'zqGot 'replace_names' and wrapped function {!r} uses *args, need 'positional_parameter_names' or 'replace_all_args'i'  ÚlabelzUlabel_namer {!r} can't be found as the parameter without 'positional_parameter_names'zLlabel_namer {!r} can't be found in the parameter names (known argnames: %s).)rC  c               sÀ  ˆ}ˆ}ˆ‰ d }ˆd kr.t dd„ |D ƒƒ}nˆrhˆ|ˆƒ‰ ˆrhˆ rhˆˆ krhˆ  ˆ¡}dˆ krhˆ d¡}|t|ƒk r~|| }n| ˆd ¡}t|tƒs˜d }ˆ
d ks¨ˆ	dkrÄt ‡fdd„t|ƒD ƒƒ}n6tˆ ƒt|ƒk rÜtdƒ‚t ‡ ‡‡
fdd„t|ƒD ƒƒ}ˆ
d kr‡fdd	„| ¡ D ƒ}n‡‡
fd
d	„| ¡ D ƒ}t|ƒ|kpHd|k}ˆr°|s°|t|ƒk rxt	|| |ƒ|d< n8ˆ|kr–t	|ˆ |ƒ|d< nt
jdˆˆjf tdd ˆ| f|ž|ŽS )Nc             s   s   | ]}t |ƒV  qd S )N)r   )r=   r   r   r   r   rî   Ñ  s    zA_preprocess_data.<locals>.param.<locals>.inner.<locals>.<genexpr>rK  Tc             3   s   | ]\}}t ˆ |ƒV  qd S )N)rD  )r=   Újr   )rC  r   r   rî   ê  s   z#Got more args than function expectsc             3   s,   | ]$\}}ˆ | ˆkr t ˆ|ƒn|V  qd S )N)rD  )r=   rL  r   )Ú
_arg_namesrC  rG  r   r   rî   ò  s   c                s   i | ]\}}t ˆ |ƒ|“qS r   )rD  )r=   ró   rq   )rC  r   r   r@   ø  s    zB_preprocess_data.<locals>.param.<locals>.inner.<locals>.<dictcomp>c                s(   i | ] \}}|ˆkrt ˆ |ƒn||“qS r   )rD  )r=   ró   rq   )rC  rG  r   r   r@   û  s   z™Tried to set a label via parameter %r in func %r but couldn't find such an argument.
(This is a programming error, please report to the Matplotlib list!)r	  )r)  )ÚtupleÚindexrà   r   r   rƒ   r^   r¤   r­   r   r0   r1   r[   ÚRuntimeWarning)ZaxrC  rO   rP   Z
_label_posZ_label_namer_posrK  Zuser_supplied_label)	Ú	arg_namesÚarg_names_at_runtimerT   Úlabel_namerÚlabel_namer_posÚ	label_posÚpositional_parameter_namesrH  rG  )rM  rC  r   ÚinnerÄ  sV    








z._preprocess_data.<locals>.param.<locals>.inner)ÚinspectZ	signaturer¬   rJ  ÚvaluesZkindr   ZVAR_POSITIONALZVAR_KEYWORDr«   rË   ZKEYWORD_ONLYÚinsertÚreplacerà   ÚsetrW   r2   r[   rV   rO  rc   rf   rI  rX   Z__signature__)
rT   ZsigZ_has_varargsZ_has_varkwargsrM  ZparamsÚpZ
data_paramZnew_sigrW  )rS  rV  rH  rG  )rQ  rR  rT   rT  rU  r   Úparamf  s|    











$O
z_preprocess_data.<locals>.param)r\  )rG  rH  rS  rV  r^  r   )rS  rV  rH  rG  r   Ú_preprocess_data>  s
    % 4r_  zmatplotlib version %szinteractive is %szplatform is %szloaded modules: %s)r    r!   )N)F)F)FT)FT)NFTr   )NFNN)ŒrX   r+   r3  r7  rŒ   Zcollections.abcr   Ú
contextlibZdistutils.versionr   rc   ÚioÚ	importlibrX  r   r  r'   rŠ   Zpathlibr   rá   rï   r   r¶   ri   r‰   Zurllib.requestr  r0   rÉ   r   r	   Zmatplotlib.cbookr
   r   r   r   r   Zmatplotlib.rcsetupr   r   r   ZnumpyZ_versionr   rƒ   Ú__version__Z	getLoggerr[   r*   Z__version__numpy__Z
__bibtex__r   ZdateutilZ	pyparsingÚhasattrr   r`   r6   r;   Úobjectr<   rç   rè   Úverbosere   rr   rt   ru   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  r  r  rø   r  rÙ   r¡   Úisabsrm   Z_basedirZ_fnameÚrealpathr±   Z	_fullpathrô   r  r­   r  Ú	setlocaleÚLC_ALLr  r  r  r!  r"  r+  r‹   r   r,  r-  r.  r/  r>  r8  rB  Z__test__rD  rF  rI  r_  r#   rv   r¬   r*  r   r   r   r   Ú<module>e   s*  




#c


"
	7 


N
+

IB
F	
& 
/# 
 ]