3
ƽh             "   @   s  d Z ddlZddlZddlZddlZddlmZ ddlZddlZddl	Z	yddl
Z
W n ek
rp   ddlZ
Y nX ddlmZ ddlZddlZddlZddlmZmZ ddlmZmZ ddlmZ ddlmZ dd	lmZmZ dd
lmZmZ ddlmZ ddlmZm Z m!Z!m"Z" ddl#m$Z% ddl&m'Z' ddl(m)Z)m*Z* ddl+m,Z, ddlm-Z- ddl.m/Z/ ddlm0Z0 ddl1m2Z2m3Z3 ddl4Z5ddl6m7Z7 ddl8m9Z9 ddl:m;Z;m<Z< ddl=m>Z>m?Z?m@Z@mAZA ddlBmCZCmDZDmEZEmFZF ddlGmHZHmIZImJZJmKZKmLZLmMZMmNZNmOZOmPZPmQZQmRZRmSZSmTZTmUZUmVZVmWZWmXZXmYZYmZZZ ej[e\Z]ej^ej^ddddd  j_ej`ej`dd!d"d  j_iZadd#d$Zbdacd%add&d' Zed(d) ZfejgjhZhejiejjd*d+ Zjebe'jkdd-d.Zkd/d0 Zld1d2 Zmd3d4 Znd5d6 Zod7d8 Zpd9d: Zqd;d< Zrd=d> Zsd?d@ ZtdAdB ZuebejvdCdD ZvebejwddEdFZwebejxdGdH ZxebejyjzdIdJ Zzebejyj{dKdL Z{ebejyj|dMdN Z|ddQdRZ}G dSdT dTZ~dddddd,ed%fdUdVZdWdX ZdYdZ Zd[d\ Zd]d^ Zd_d` Zdadb Zebejdcdd Zebejdedf ZddgdhZdidj Zdkdl Zebejdmdn Zdodp Zejj r`ejj jdqdre_ ejddsdtZddudvZdwdx Zejdydz Zej`d{d|dd}d~ZddddddZdddZdddZdddZdddZej`d{ddddZdddZdd Zdd ZdddZdddZdddZdddZdd Zdd Zdd Zdd ZdddZejje_ dddZdd ZebejjdddZebejjdd ZdddZdd Zed rejedee%ddh krej rejedej emed  ee  ebejdddZebejdddZebejdd Zebejdd Zebejddd,ejejejfddZebejdddÄZebejddń ZebejÃdddǄZebe)jăddȜddʄZebe)jŃdddȜdd̄Zebe)jƃdd΄ Zebe)jǃddЄ Zebe)jȃdddӄZebe)jɃdddՄZebe)jʃdddׄZebe)j˃d,d؜ddڄZebe)j̃dddۜdd݄Zebe)j̓ddd߄Zebe)j΃dddZebe)jσddddddZebe)jЃddȜddZebe)jуdddddZebe)j҃dddȜddZebe)jӃddȜddZebe)jԃdd Zebe)jՃdddZebe)jփddPde-je-jddddf	ddȜddZebe)jكddȜddZebe)jڃddȜddZebe)jۃdddȜddZebe)j܃dddȜddZebe)j݃dddȜddZebe)jރddȜddZebe)j߃dddȜddZebe)jdddȜdd	Zebe)jdddZebe)jddOddddddddddde5jdd%fddȜddZebe)jdddȜddZebe)jdddȜddZebe)jdddȜddZebe)jdd,dddddddZebe)jdd Zebe)jdd d!Zebe)jd"d# Zebe)jdddȜd$d%Zebe)jddd,d&d'd(Zebe)jd)d* Zebe)jd+d, Zebe)jdddddddd-d.d/Zebe)jddddddd%dd0d1d2Zebe)jdddȜd3d4Zebe)jdddd7d8d9Zebe)jd,d,dd:d;d<Zebe)jdddȜd>d?Zebe)jdddȜd@dAZebe)jddȜdBdCZebe)jdDdE Zebe)jdddddddddejjdfd%ddFdGdHZebe)jdIdJ Zebe)jdKdL Zebe)jdddȜdMdNZebe)jddQdRZebe)jf ddSddTdUdVZebe)jdddddd,ddWdXdYZebe)j dZdd[d\d]Z ebe)jdddȜd`daZebe)jddfdgZebe)jddhdiZebe)jddjdkZebe)jdddddddldmdnZebe)jdodp Zebe)jdqdr Zebe)jdsdddddtddudvdwZebe)jdxdy Zebe)j	dddȜd{d|Z	ebe)j
dddȜd}d~Z
ebe)jd,e-jd,dfddȜddZebe)jdd Zebe)jdddddZebe)jdddddZebe)jdddddZebe)jdd Zebe)j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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*e  dS (  a  
`matplotlib.pyplot` is a state-based interface to matplotlib. It provides
a MATLAB-like way of plotting.

pyplot is mainly intended for interactive plots and simple cases of
programmatic plot generation::

    import numpy as np
    import matplotlib.pyplot as plt

    x = np.arange(0, 5, 0.1)
    y = np.sin(x)
    plt.plot(x, y)

The object-oriented API is recommended for more complex plots.
    N)Number)cycler)rcsetupstyle)_pylab_helpersinteractive)cbook)	docstring)FigureCanvasBaseMouseButton)Figure	figaspect)GridSpec)rcParamsrcParamsDefaultget_backendrcParamsOrig)interactive_bk)Artist)AxesSubplot)	PolarAxes)mlab)get_scale_names)cm)get_cmapregister_cmap)	Normalize)Line2D)Text
Annotation)Polygon	RectangleCircleArrow)SubplotToolButtonSliderWidget   )
TickHelper	FormatterFixedFormatterNullFormatterFuncFormatterFormatStrFormatterScalarFormatterLogFormatterLogFormatterExponentLogFormatterMathtextLocatorIndexLocatorFixedLocatorNullLocatorLinearLocator
LogLocatorAutoLocatorMultipleLocatorMaxNLocator oldnewc             C   s   d S )N )r?   r@   r@   7/tmp/pip-build-7iwl8md4/matplotlib/matplotlib/pyplot.py<lambda>L   s    rB   pc             C   s   d S )Nr@   )rC   r@   r@   rA   rB   N   s    c             C   s   |d krt jt| S tj| g}x~t| dd d k	rxbtj D ]V\}}| j|kr<dd t	|j
| jD }|d | jksxt|jd |j|f | q<W | j} q"W x|d d d D ]}||}qW |S )N__wrapped__c             S   s   i | ]\}}|j |qS r@   )cell_contents).0kvr@   r@   rA   
<dictcomp>\   s   z3_copy_docstring_and_deprecators.<locals>.<dictcomp>funcr)   )	functoolspartial_copy_docstring_and_deprecatorsr	   copygetattr
_code_objsitems__code__zipco_freevars__closure__rD   AssertionErrorpopappend)methodrJ   Z
decoratorsZdecorator_makercodekwargsZ	decoratorr@   r@   rA   rN   R   s    


rN   Fc              C   s   G dd dt } ydtjkrddlm} | }|dkr<|  trDdS dd }y|jjd	| W n tk
r|   |j	| Y nX |ad
a
ddlm} |jt }|r|j| nda
W n t| fk
r   da
Y nX dS )z
    Install a repl display hook so that any stale figure are automatically
    redrawn when control is returned to the repl.

    This works both with IPython and with vanilla python shells.
    c               @   s   e Zd ZdS )z-install_repl_displayhook.<locals>._NotIPythonN)__name__
__module____qualname__r@   r@   r@   rA   _NotIPythony   s   r`   IPythonr   )get_ipythonNc               S   s   t j rt  d S )N)
matplotlibis_interactivedraw_allr@   r@   r@   rA   post_execute   s    z.install_repl_displayhook.<locals>.post_executerf   F)backend2guiT)	Exceptionsysmodulesra   rb   _IP_REGISTEREDeventsregisterAttributeErrorZregister_post_execute_INSTALL_FIG_OBSERVERZIPython.core.pylabtoolsrg   getr   Z
enable_guiImportError)r`   rb   iprf   rg   Zipython_gui_namer@   r@   rA   install_repl_displayhooko   s.    

rs   c              C   sf   t rZddlm}  |  }y|jjdt  W n, tk
rT } ztd|W Y dd}~X nX da trbdadS )a  
    Uninstall the matplotlib display hook.

    .. warning::

       Need IPython >= 2 for this to work.  For IPython < 2 will raise a
       ``NotImplementedError``

    .. warning::

       If you are using vanilla python and have installed another
       display hook this will reset ``sys.displayhook`` to what ever
       function was there when matplotlib installed it's displayhook,
       possibly discarding your changes.
    r   )rb   rf   z*Can not unregister events in IPython < 2.0NF)rk   ra   rb   rl   
unregisterrn   NotImplementedErrorro   )rb   rr   errr@   r@   rA   uninstall_repl_displayhook   s    rw   c              O   s   t j| |S )N)rc   set_loglevel)argsr\   r@   r@   rA   rx      s    rx   Tc             C   s   | d krt  } | j||dS )N)include_self)gcffindobj)omatchrz   r@   r@   rA   r|      s    r|   c             C   s   t | jdd S )NZrequired_interactive_framework)rP   ZFigureCanvas)backend_modr@   r@   rA   #_get_required_interactive_framework   s    r   c       
         sv  ddl }td | tjkrtj }dddddd	d
d}|j|d}|dk	rR|g}ng }|d	ddddg7 }xP|D ]4}yt| W n tk
r   wnY qnX |t	d< dS qnW td
 d
t	d< dS tj
|  G  fddd|jj}t|}|dk	rtj }|r|r||krtdj| ||tjd| |j |  td< td< |ax&dD ]}	tjt||	t |	 _qHW | |j_dS )a  
    Close all open figures and set the Matplotlib backend.

    The argument is case-insensitive.  Switching to an interactive backend is
    possible only if no event loop for another interactive backend has started.
    Switching to and from non-interactive backends is always possible.

    Parameters
    ----------
    newbackend : str
        The name of the backend to use.
    r   NallZqt5aggZqt4aggZgtk3aggZwxaggZtkaggmacosxZagg)Zqt5Zqt4Zgtk3ZwxZtkr   Zheadlessbackendc                   s"   e Zd Ze jeej  dS )z#switch_backend.<locals>.backend_modN)r]   r^   r_   localsupdatevars	importlibimport_moduler@   )backend_namer@   rA   r     s   r   zdCannot load backend {!r} which requires the {!r} interactive framework, as {!r} is currently runningzLoaded backend %s version %s.new_figure_managerdraw_if_interactiveshow)r   r   r   )Zmatplotlib.backendscloser   _auto_backend_sentinelr   "_get_running_interactive_frameworkrp   switch_backendrq   r   Z_backend_module_nameZbackend_basesZ_Backendr   format_logdebugZbackend_versionr   r   _backend_modinspect	signaturerP   globals__signature__backendsr   )
Z
newbackendrc   Zcurrent_frameworkmappingZ
best_guess
candidates	candidater   Zrequired_framework	func_namer@   )r   rA   r      sX    






r   c               C   s&   t tr"tj tj k	r"tjd d S )NzFStarting a Matplotlib GUI outside of the main thread will likely fail.)r   r   	threadingcurrent_threadmain_threadr   _warn_externalr@   r@   r@   rA   _warn_if_gui_out_of_main_thread/  s    r   c              O   s   t   tj| |S )z%Create a new figure manager instance.)r   r   r   )ry   r\   r@   r@   rA   r   8  s    r   c              O   s   t j| |S )N)r   r   )ry   r\   r@   r@   rA   r   ?  s    r   c              O   s   t   tj| |S )a6  
    Display all open figures.

    In non-interactive mode, *block* defaults to True.  All figures
    will display and show will not return until all windows are closed.
    If there are no figures, return immediately.

    In interactive mode *block* defaults to False.  This will ensure
    that all of the figures are shown and this function immediately returns.

    Parameters
    ----------
    block : bool, optional

        If `True` block and run the GUI main loop until all windows
        are closed.

        If `False` ensure that all windows are displayed and return
        immediately.  In this case, you are responsible for ensuring
        that the event loop is running to have responsive figures.

    See Also
    --------
    ion : enable interactive mode
    ioff : disable interactive mode

    )r   r   r   )ry   r\   r@   r@   rA   r   D  s    r   c               C   s   t j S )a  
    Return if pyplot is in "interactive mode" or not.

    If in interactive mode then:

      - newly created figures will be shown immediately
      - figures will automatically redraw on change
      - `.pyplot.show` will not block by default

    If not in interactive mode then:

      - newly created figures and changes to figures will
        not be reflected until explicitly asked to be
      - `.pyplot.show` will block by default

    See Also
    --------
    ion : enable interactive mode
    ioff : disable interactive mode

    show : show windows (and maybe block)
    pause : show windows, run GUI event loop, and block for a time
    )rc   rd   r@   r@   r@   rA   isinteractived  s    r   c               C   s   t jd t  dS )z
    Turn the interactive mode off.

    See Also
    --------
    ion : enable interactive mode
    isinteractive : query current state

    show : show windows (and maybe block)
    pause : show windows, run GUI event loop, and block for a time
    FN)rc   r   rw   r@   r@   r@   rA   ioff  s    
r   c               C   s   t jd t  dS )z
    Turn the interactive mode on.

    See Also
    --------
    ioff : disable interactive mode
    isinteractive : query current state

    show : show windows (and maybe block)
    pause : show windows, run GUI event loop, and block for a time
    TN)rc   r   rs   r@   r@   r@   rA   ion  s    
r   c             C   sL   t jj }|dk	r>|j}|jjr(|j  tdd |j|  n
t	j
|  dS )a  
    Run the GUI event loop for *interval* seconds.

    If there is an active figure, it will be updated and displayed before the
    pause, and the GUI event loop (if any) will run during the pause.

    This can be used for crude animation.  For more complex animation use
    :mod:`matplotlib.animation`.

    If there is no active figure, sleep for *interval* seconds instead.

    See Also
    --------
    matplotlib.animation : Complex animation
    show : show figures and optional block forever
    NF)block)r   Gcf
get_activecanvasfigurestale	draw_idler   Zstart_event_looptimesleep)intervalmanagerr   r@   r@   rA   pause  s    

r   c             K   s   t j| f| d S )N)rc   rc)groupr\   r@   r@   rA   r     s    r   c             C   s   t j| |S )N)rc   
rc_context)r   fnamer@   r@   rA   r     s    r   c               C   s   t j  t j rt  d S )N)rc   
rcdefaultsrd   re   r@   r@   r@   rA   r     s    r   c             O   s   t jj| f||S )N)rc   artistgetp)objry   r\   r@   r@   rA   r     s    r   c             O   s   t jj| f||S )N)rc   r   rp   )r   ry   r\   r@   r@   rA   rp     s    rp   c             O   s   t jj| f||S )N)rc   r   setp)r   ry   r\   r@   r@   rA   r     s    r   d      c             C   s   t | ||S )a  
    Turn on `xkcd <https://xkcd.com/>`_ sketch-style drawing mode.  This will
    only have effect on things drawn after this function is called.

    For best results, the "Humor Sans" font should be installed: it is
    not included with Matplotlib.

    Parameters
    ----------
    scale : float, optional
        The amplitude of the wiggle perpendicular to the source line.
    length : float, optional
        The length of the wiggle along the line.
    randomness : float, optional
        The scale factor by which the length is shrunken or expanded.

    Notes
    -----
    This function works by a number of rcParams, so it will probably
    override others you have set before.

    If you want the effects of this function to be temporary, it can
    be used as a context manager, for example::

        with plt.xkcd():
            # This figure will be in XKCD-style
            fig1 = plt.figure()
            # ...

        # This figure will be in regular style
        fig2 = plt.figure()
    )_xkcd)scalelength
randomnessr@   r@   rA   xkcd  s    !r   c               @   s$   e Zd Zdd Zdd Zdd ZdS )r   c             C   sp   t j | _t d rtdddlm} t jddddd	gd
|||f|jdddgdddddddddddd d S )Nztext.usetexz3xkcd mode is not compatible with text.usetex = Truer   )patheffectsr   zxkcd Scriptz
Humor Sansz
Comic NeuezComic Sans MSg      ,@   w)	linewidthZ
foregroundg      ?g       @Zwhiteg        FZblack      )zfont.familyz	font.sizezpath.sketchzpath.effectszaxes.linewidthzlines.linewidthzfigure.facecolorzgrid.linewidthz	axes.gridzaxes.unicode_minuszaxes.edgecolorzxtick.major.sizezxtick.major.widthzytick.major.sizezytick.major.width)r   rO   _origRuntimeErrorrc   r   r   Z
withStroke)selfr   r   r   r   r@   r@   rA   __init__  s,    
z_xkcd.__init__c             C   s   | S )Nr@   )r   r@   r@   rA   	__enter__"  s    z_xkcd.__enter__c             G   s   t jt| j d S )N)dictr   r   r   )r   ry   r@   r@   rA   __exit__%  s    z_xkcd.__exit__N)r]   r^   r_   r   r   r   r@   r@   r@   rA   r     s   r   c          	   K   s  |dkrt d }|dkr t d }|dkr0t d }|dkr@t d }t }	|	rVt|	d nd}
d}| dkrl|
} nPt| tr| }t }||kr|dkrtjd	 |
} q|j|}|	| } nt	| } t
jj| }|dkrpt d
 }t|	|  kodkn  rtjd| t t j dkrd}t| f||||||d|}|jj}|rR|j| t
jj| t  trpt|_|r|jjj  |jjS )u  
    Create a new figure, or activate an existing figure.

    Parameters
    ----------
    num : int or str, optional
        A unique identifier for the figure.

        If a figure with that identifier already exists, this figure is made
        active and returned. An integer refers to the ``Figure.number``
        attribute, a string refers to the figure label.

        If there is no figure with the identifier or *num* is not given, a new
        figure is created, made active and returned.  If *num* is an int, it
        will be used for the ``Figure.number`` attribute, otherwise, an
        auto-generated integer value is used (starting at 1 and incremented
        for each new figure). If *num* is a string, the figure label and the
        window title is set to this value.

    figsize : (float, float), default: :rc:`figure.figsize`
        Width, height in inches.

    dpi : float, default: :rc:`figure.dpi`
        The resolution of the figure in dots-per-inch.

    facecolor : color, default: :rc:`figure.facecolor`
        The background color.

    edgecolor : color, default: :rc:`figure.edgecolor`
        The border color.

    frameon : bool, default: True
        If False, suppress drawing the figure frame.

    FigureClass : subclass of `~matplotlib.figure.Figure`
        Optionally use a custom `.Figure` instance.

    clear : bool, default: False
        If True and the figure already exists, then it is cleared.

    tight_layout : bool or dict, default: :rc:`figure.autolayout`
        If ``False`` use *subplotpars*. If ``True`` adjust subplot
        parameters using `.tight_layout` with default padding.
        When providing a dict containing the keys ``pad``, ``w_pad``,
        ``h_pad``, and ``rect``, the default `.tight_layout` paddings
        will be overridden.

    constrained_layout : bool, default: :rc:`figure.constrained_layout.use`
        If ``True`` use constrained layout to adjust positioning of plot
        elements.  Like ``tight_layout``, but designed to be more
        flexible.  See
        :doc:`/tutorials/intermediate/constrainedlayout_guide`
        for examples.  (Note: does not work with `add_subplot` or
        `~.pyplot.subplot2grid`.)


    **kwargs : optional
        See `~.matplotlib.figure.Figure` for other possible arguments.

    Returns
    -------
    `~matplotlib.figure.Figure`
        The `.Figure` instance returned will also be passed to
        new_figure_manager in the backends, which allows to hook custom
        `.Figure` classes into the pyplot interface. Additional kwargs will be
        passed to the `.Figure` init function.

    Notes
    -----
    If you are creating many figures, make sure you explicitly call
    `.pyplot.close` on the figures you are not using, because this will
    enable pyplot to properly clean up the memory.

    `~matplotlib.rcParams` defines the default values, which can be modified
    in the matplotlibrc file.
    Nzfigure.figsizez
figure.dpizfigure.facecolorzfigure.edgecolorr)   r=   r   z(close('all') closes all existing figureszfigure.max_open_warningzMore than %d figures have been opened. Figures created through the pyplot interface (`matplotlib.pyplot.figure`) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam `figure.max_open_warning`).ZpsH   )figsizedpi	facecolor	edgecolorframeonFigureClass)r   get_fignumsmax
isinstancestrget_figlabelsr   r   indexintr   r   Zget_fig_managerlenRuntimeWarningr   lowerr   r   r   Z	set_labelZ_set_new_active_managerr   ro   _auto_draw_if_interactiveZstale_callbackclear)numr   r   r   r   r   r   r   r\   ZallnumsZnext_numZfigLabel	allLabelsZinum
figManagerZmax_open_warningfigr@   r@   rA   r   +  sd    W





r   c          	   C   sF   |rBt j rB| jj  rB| jj rB| jj  | jj  W dQ R X dS )z
    An internal helper function for making sure that auto-redrawing
    works as intended in the plain python repl.

    Parameters
    ----------
    fig : Figure
        A figure object which is assumed to be associated with a canvas
    N)rc   rd   r   Z	is_savingZ_is_idle_drawingZ_idle_draw_cntxr   )r   valr@   r@   rA   r     s
    

r   c              C   s$   t jj } | dk	r| jjS t S dS )zw
    Get the current figure.

    If no current figure exists, a new one is created using
    `~.pyplot.figure()`.
    N)r   r   r   r   r   )r   r@   r@   rA   r{     s    
r{   c             C   s   t jj| p| t kS )z3Return whether the figure with the given id exists.)r   r   Z
has_fignumr   )r   r@   r@   rA   fignum_exists  s    r   c               C   s   t tjjS )z)Return a list of existing figure numbers.)sortedr   r   Zfigsr@   r@   r@   rA   r     s    r   c              C   s(   t jj } | jdd d dd | D S )z(Return a list of existing figure labels.c             S   s   | j S )N)r   )mr@   r@   rA   rB     s    zget_figlabels.<locals>.<lambda>)keyc             S   s   g | ]}|j jj qS r@   )r   r   Z	get_label)rF   r   r@   r@   rA   
<listcomp>  s    z!get_figlabels.<locals>.<listcomp>)r   r   Zget_all_fig_managerssort)ZfigManagersr@   r@   rA   r     s    
r   c               C   s
   t  jjS )ai  
    Return the figure manager of the current figure.

    The figure manager is a container for the actual backend-depended window
    that displays the figure on screen.

    If if no current figure exists, a new one is created an its figure
    manager is returned.

    Returns
    -------
    `.FigureManagerBase` or backend-dependent subclass thereof
    )r{   r   r   r@   r@   r@   rA   get_current_fig_manager  s    r   c             C   s   t  jj| |S )N)r{   r   mpl_connect)srJ   r@   r@   rA   connect  s    r   c             C   s   t  jj| S )N)r{   r   mpl_disconnect)Zcidr@   r@   rA   
disconnect  s    r   c             C   s   | dkr,t jj }|dkrdS t jj| n| dkr@t jj  nt| trXt jj|  npt| drrt jj| j nVt| trt	 }| |krt
 |j|  }t jj| n t| trt jj|  ntddS )al  
    Close a figure window.

    Parameters
    ----------
    fig : None or int or str or `.Figure`
        The figure to close. There are a number of ways to specify this:

        - *None*: the current figure
        - `.Figure`: the given `.Figure` instance
        - ``int``: a figure number
        - ``str``: a figure name
        - 'all': all figures

    Nr   r   zFclose() argument must be a Figure, an int, a string, or None, not '%s')r   r   r   destroyZdestroy_allr   r   hasattrr   r   r   r   r   Zdestroy_fig	TypeError)r   r   r   r   r@   r@   rA   r     s&    




r   c               C   s   t  j  dS )zClear the current figure.N)r{   clfr@   r@   r@   rA   r   D  s    r   c               C   s   t  jj  dS )a  
    Redraw the current figure.

    This is used to update a figure that has been altered, but not
    automatically re-drawn.  If interactive mode is on (via `.ion()`), this
    should be only rarely needed, but there may be ways to modify the state of
    a figure without marking it as "stale".  Please report these cases as bugs.

    This is equivalent to calling ``fig.canvas.draw_idle()``, where ``fig`` is
    the current figure.
    N)r{   r   r   r@   r@   r@   rA   drawI  s    r   c              O   s    t  }|j| |}|jj  |S )N)r{   savefigr   r   )ry   r\   r   resr@   r@   rA   r   X  s    
r   c              O   s   t  j| |S )N)r{   legend)ry   r\   r@   r@   rA   	figlegendc  s    r   zlegend(z
figlegend(c             K   s&   | dkrt d|S t j| f|S dS )a+  
    Add an axes to the current figure and make it the current axes.

    Call signatures::

        plt.axes()
        plt.axes(rect, projection=None, polar=False, **kwargs)
        plt.axes(ax)

    Parameters
    ----------
    arg : None or 4-tuple
        The exact behavior of this function depends on the type:

        - *None*: A new full window axes is added using
          ``subplot(111, **kwargs)``.
        - 4-tuple of floats *rect* = ``[left, bottom, width, height]``.
          A new axes is added with dimensions *rect* in normalized
          (0, 1) units using `~.Figure.add_axes` on the current figure.

    projection : {None, 'aitoff', 'hammer', 'lambert', 'mollweide', 'polar', 'rectilinear', str}, optional
        The projection type of the `~.axes.Axes`. *str* is the name of
        a custom projection, see `~matplotlib.projections`. The default
        None results in a 'rectilinear' projection.

    polar : bool, default: False
        If True, equivalent to projection='polar'.

    sharex, sharey : `~.axes.Axes`, optional
        Share the x or y `~matplotlib.axis` with sharex and/or sharey.
        The axis will have the same limits, ticks, and scale as the axis
        of the shared axes.

    label : str
        A label for the returned axes.

    Returns
    -------
    `~.axes.Axes`, or a subclass of `~.axes.Axes`
        The returned axes class depends on the projection used. It is
        `~.axes.Axes` if rectilinear projection is used and
        `.projections.polar.PolarAxes` if polar projection is used.

    Other Parameters
    ----------------
    **kwargs
        This method also takes the keyword arguments for
        the returned axes class. The keyword arguments for the
        rectilinear axes class `~.axes.Axes` can be found in
        the following table but there might also be other keyword
        arguments if another projection is used, see the actual axes
        class.

        %(Axes)s

    Notes
    -----
    If the figure already has a axes with key (*args*,
    *kwargs*) then it will simply make that axes current and
    return it.  This behavior is deprecated. Meanwhile, if you do
    not want this behavior (i.e., you want to force the creation of a
    new axes), you must use a unique set of args and kwargs.  The axes
    *label* attribute has been exposed for this purpose: if you want
    two axes that are otherwise identical to be added to the figure,
    make sure you give them unique labels.

    See Also
    --------
    .Figure.add_axes
    .pyplot.subplot
    .Figure.add_subplot
    .Figure.subplots
    .pyplot.subplots

    Examples
    --------
    ::

        # Creating a new full window axes
        plt.axes()

        # Creating a new axes with specified dimensions and some kwargs
        plt.axes((left, bottom, width, height), facecolor='w')
    No   )r   )subplotr{   add_axes)argr\   r@   r@   rA   axesk  s    X
r   c             C   s   | dkrt  } | j  dS )zS
    Remove an `~.axes.Axes` (defaulting to the current axes) from its figure.
    N)gcaremove)axr@   r@   rA   delaxes  s    r  c             C   s8   t | jjdstdtjj| jjj | jj|  dS )zT
    Set the current Axes to *ax* and the current Figure to the parent of *ax*.
    r   z+Axes parent figure is not managed by pyplotN)	r   r   r   
ValueErrorr   r   
set_activer   sca)r  r@   r@   rA   r    s    r  c              O   s   t | dkrd	} t | dkr4t| d tr4tjd d|ksDd|krLtdt }|j| |}|j}g }x.|j	D ]$}||kr~qp|j
|jrp|j| qpW x|D ]}t| qW |S )
ar  
    Add a subplot to the current figure.

    Wrapper of `.Figure.add_subplot` with a difference in behavior
    explained in the notes section.

    Call signatures::

       subplot(nrows, ncols, index, **kwargs)
       subplot(pos, **kwargs)
       subplot(**kwargs)
       subplot(ax)

    Parameters
    ----------
    *args : int, (int, int, *index*), or `.SubplotSpec`, default: (1, 1, 1)
        The position of the subplot described by one of

        - Three integers (*nrows*, *ncols*, *index*). The subplot will take the
          *index* position on a grid with *nrows* rows and *ncols* columns.
          *index* starts at 1 in the upper left corner and increases to the
          right. *index* can also be a two-tuple specifying the (*first*,
          *last*) indices (1-based, and including *last*) of the subplot, e.g.,
          ``fig.add_subplot(3, 1, (1, 2))`` makes a subplot that spans the
          upper 2/3 of the figure.
        - A 3-digit integer. The digits are interpreted as if given separately
          as three single-digit integers, i.e. ``fig.add_subplot(235)`` is the
          same as ``fig.add_subplot(2, 3, 5)``. Note that this can only be used
          if there are no more than 9 subplots.
        - A `.SubplotSpec`.

    projection : {None, 'aitoff', 'hammer', 'lambert', 'mollweide', 'polar', 'rectilinear', str}, optional
        The projection type of the subplot (`~.axes.Axes`). *str* is the name
        of a custom projection, see `~matplotlib.projections`. The default
        None results in a 'rectilinear' projection.

    polar : bool, default: False
        If True, equivalent to projection='polar'.

    sharex, sharey : `~.axes.Axes`, optional
        Share the x or y `~matplotlib.axis` with sharex and/or sharey. The
        axis will have the same limits, ticks, and scale as the axis of the
        shared axes.

    label : str
        A label for the returned axes.

    Returns
    -------
    `.axes.SubplotBase`, or another subclass of `~.axes.Axes`

        The axes of the subplot. The returned axes base class depends on
        the projection used. It is `~.axes.Axes` if rectilinear projection
        is used and `.projections.polar.PolarAxes` if polar projection
        is used. The returned axes is then a subplot subclass of the
        base class.

    Other Parameters
    ----------------
    **kwargs
        This method also takes the keyword arguments for the returned axes
        base class; except for the *figure* argument. The keyword arguments
        for the rectilinear base class `~.axes.Axes` can be found in
        the following table but there might also be other keyword
        arguments if another projection is used.

        %(Axes)s

    Notes
    -----
    Creating a subplot will delete any pre-existing subplot that overlaps
    with it beyond sharing a boundary::

        import matplotlib.pyplot as plt
        # plot a line, implicitly creating a subplot(111)
        plt.plot([1, 2, 3])
        # now create a subplot which represents the top plot of a grid
        # with 2 rows and 1 column. Since this subplot will overlap the
        # first, the plot (and its axes) previously created, will be removed
        plt.subplot(211)

    If you do not want this behavior, use the `.Figure.add_subplot` method
    or the `.pyplot.axes` function instead.

    If the figure already has a subplot with key (*args*,
    *kwargs*) then it will simply make that subplot current and
    return it.  This behavior is deprecated. Meanwhile, if you do
    not want this behavior (i.e., you want to force the creation of a
    new subplot), you must use a unique set of args and kwargs.  The axes
    *label* attribute has been exposed for this purpose: if you want
    two subplots that are otherwise identical to be added to the figure,
    make sure you give them unique labels.

    In rare circumstances, `.add_subplot` may be called with a single
    argument, a subplot axes instance already created in the
    present figure but not in the figure's list of axes.

    See Also
    --------
    .Figure.add_subplot
    .pyplot.subplots
    .pyplot.axes
    .Figure.subplots

    Examples
    --------
    ::

        plt.subplot(221)

        # equivalent but more general
        ax1=plt.subplot(2, 2, 1)

        # add a subplot with no frame
        ax2=plt.subplot(222, frameon=False)

        # add a polar subplot
        plt.subplot(223, projection='polar')

        # add a red subplot that shares the x-axis with ax1
        plt.subplot(224, sharex=ax1, facecolor='red')

        # delete ax2 from the figure
        plt.delaxes(ax2)

        # add ax2 to the figure again
        plt.subplot(ax2)
    r   r)   r   r   zbThe subplot index argument to subplot() appears to be a boolean. Did you intend to use subplots()?nrowsncolszhsubplot() got an unexpected keyword argument 'ncols' and/or 'nrows'.  Did you intend to call subplots()?)r)   r)   r)   )r   r   boolr   r   r   r{   add_subplotbboxr   fully_overlapsrY   r  )ry   r\   r   r  r  axes_to_deleteother_ax	ax_to_delr@   r@   rA   r     s&     

r   z3.3sharexc       
   	   K   s*   t f |}|j| ||||||d}	||	fS )a  
    Create a figure and a set of subplots.

    This utility wrapper makes it convenient to create common layouts of
    subplots, including the enclosing figure object, in a single call.

    Parameters
    ----------
    nrows, ncols : int, default: 1
        Number of rows/columns of the subplot grid.

    sharex, sharey : bool or {'none', 'all', 'row', 'col'}, default: False
        Controls sharing of properties among x (*sharex*) or y (*sharey*)
        axes:

        - True or 'all': x- or y-axis will be shared among all subplots.
        - False or 'none': each subplot x- or y-axis will be independent.
        - 'row': each subplot row will share an x- or y-axis.
        - 'col': each subplot column will share an x- or y-axis.

        When subplots have a shared x-axis along a column, only the x tick
        labels of the bottom subplot are created. Similarly, when subplots
        have a shared y-axis along a row, only the y tick labels of the first
        column subplot are created. To later turn other subplots' ticklabels
        on, use `~matplotlib.axes.Axes.tick_params`.

    squeeze : bool, default: True
        - If True, extra dimensions are squeezed out from the returned
          array of `~matplotlib.axes.Axes`:

          - if only one subplot is constructed (nrows=ncols=1), the
            resulting single Axes object is returned as a scalar.
          - for Nx1 or 1xM subplots, the returned object is a 1D numpy
            object array of Axes objects.
          - for NxM, subplots with N>1 and M>1 are returned as a 2D array.

        - If False, no squeezing at all is done: the returned Axes object is
          always a 2D array containing Axes instances, even if it ends up
          being 1x1.

    subplot_kw : dict, optional
        Dict with keywords passed to the
        `~matplotlib.figure.Figure.add_subplot` call used to create each
        subplot.

    gridspec_kw : dict, optional
        Dict with keywords passed to the `~matplotlib.gridspec.GridSpec`
        constructor used to create the grid the subplots are placed on.

    **fig_kw
        All additional keyword arguments are passed to the
        `.pyplot.figure` call.

    Returns
    -------
    fig : `~.figure.Figure`

    ax : `.axes.Axes` or array of Axes
        *ax* can be either a single `~matplotlib.axes.Axes` object or an
        array of Axes objects if more than one subplot was created.  The
        dimensions of the resulting array can be controlled with the squeeze
        keyword, see above.

        Typical idioms for handling the return value are::

            # using the variable ax for single a Axes
            fig, ax = plt.subplots()

            # using the variable axs for multiple Axes
            fig, axs = plt.subplots(2, 2)

            # using tuple unpacking for multiple Axes
            fig, (ax1, ax2) = plt.subplot(1, 2)
            fig, ((ax1, ax2), (ax3, ax4)) = plt.subplot(2, 2)

        The names ``ax`` and pluralized ``axs`` are preferred over ``axes``
        because for the latter it's not clear if it refers to a single
        `~.axes.Axes` instance or a collection of these.

    See Also
    --------
    .pyplot.figure
    .pyplot.subplot
    .pyplot.axes
    .Figure.subplots
    .Figure.add_subplot

    Examples
    --------
    ::

        # First create some toy data:
        x = np.linspace(0, 2*np.pi, 400)
        y = np.sin(x**2)

        # Create just a figure and only one subplot
        fig, ax = plt.subplots()
        ax.plot(x, y)
        ax.set_title('Simple plot')

        # Create two subplots and unpack the output array immediately
        f, (ax1, ax2) = plt.subplots(1, 2, sharey=True)
        ax1.plot(x, y)
        ax1.set_title('Sharing Y axis')
        ax2.scatter(x, y)

        # Create four polar axes and access them through the returned array
        fig, axs = plt.subplots(2, 2, subplot_kw=dict(polar=True))
        axs[0, 0].plot(x, y)
        axs[1, 1].scatter(x, y)

        # Share a X axis with each column of subplots
        plt.subplots(2, 2, sharex='col')

        # Share a Y axis with each row of subplots
        plt.subplots(2, 2, sharey='row')

        # Share both X and Y axes with all subplots
        plt.subplots(2, 2, sharex='all', sharey='all')

        # Note that this is the same as
        plt.subplots(2, 2, sharex=True, sharey=True)

        # Create figure number 10 with a single subplot
        # and clears it if it already exists.
        fig, ax = plt.subplots(num=10, clear=True)

    )r  r	  r  shareysqueeze
subplot_kwgridspec_kw)r   subplots)
r  r	  r  r  r  r  r  fig_kwr   Zaxsr@   r@   rA   r    s     
r  .)r  r  empty_sentinelc            K   s$   t f |}|j| |||d}||fS )am  
    Build a layout of Axes based on ASCII art or nested lists.

    This is a helper function to build complex GridSpec layouts visually.

    .. note ::

       This API is provisional and may be revised in the future based on
       early user feedback.


    Parameters
    ----------
    layout : list of list of {hashable or nested} or str

        A visual layout of how you want your Axes to be arranged
        labeled as strings.  For example ::

           x = [['A panel', 'A panel', 'edge'],
                ['C panel', '.',       'edge']]

        Produces 4 axes:

        - 'A panel' which is 1 row high and spans the first two columns
        - 'edge' which is 2 rows high and is on the right edge
        - 'C panel' which in 1 row and 1 column wide in the bottom left
        - a blank space 1 row and 1 column wide in the bottom center

        Any of the entries in the layout can be a list of lists
        of the same form to create nested layouts.

        If input is a str, then it must be of the form ::

          '''
          AAE
          C.E
          '''

        where each character is a column and each line is a row.
        This only allows only single character Axes labels and does
        not allow nesting but is very terse.

    subplot_kw : dict, optional
        Dictionary with keywords passed to the `.Figure.add_subplot` call
        used to create each subplot.

    gridspec_kw : dict, optional
        Dictionary with keywords passed to the `.GridSpec` constructor used
        to create the grid the subplots are placed on.

    empty_sentinel : object, optional
        Entry in the layout to mean "leave this space empty".  Defaults
        to ``'.'``. Note, if *layout* is a string, it is processed via
        `inspect.cleandoc` to remove leading white space, which may
        interfere with using white-space as the empty sentinel.

    **fig_kw
        All additional keyword arguments are passed to the
        `.pyplot.figure` call.

    Returns
    -------
    fig : `~.figure.Figure`
       The new figure

    dict[label, Axes]
       A dictionary mapping the labels to the Axes objects.

    )r  r  r  )r   subplot_mosaic)Zlayoutr  r  r  r  r   Zax_dictr@   r@   rA   r    s    G
r  c             K   s   |dkrt  }| \}}t||j|||d}|j|f|}	|	j}
g }x.|jD ]$}||	krZqL|
j|jrL|j| qLW x|D ]}t| qzW |	S )a1  
    Create a subplot at a specific location inside a regular grid.

    Parameters
    ----------
    shape : (int, int)
        Number of rows and of columns of the grid in which to place axis.
    loc : (int, int)
        Row number and column number of the axis location within the grid.
    rowspan : int, default: 1
        Number of rows for the axis to span to the right.
    colspan : int, default: 1
        Number of columns for the axis to span downwards.
    fig : `.Figure`, optional
        Figure to place the subplot in. Defaults to the current figure.
    **kwargs
        Additional keyword arguments are handed to `~.Figure.add_subplot`.

    Returns
    -------
    `.axes.SubplotBase`, or another subclass of `~.axes.Axes`

        The axes of the subplot.  The returned axes base class depends on the
        projection used.  It is `~.axes.Axes` if rectilinear projection is used
        and `.projections.polar.PolarAxes` if polar projection is used.  The
        returned axes is then a subplot subclass of the base class.

    Notes
    -----
    The following call ::

        ax = subplot2grid((nrows, ncols), (row, col), rowspan, colspan)

    is identical to ::

        fig = gcf()
        gs = fig.add_gridspec(nrows, ncols)
        ax = fig.add_subplot(gs[row:row+rowspan, col:col+colspan])
    N)rowspancolspan)	r{   r   Znew_subplotspecr  r  r   r  rY   r  )shapelocr  r  r   r\   s1s2Zsubplotspecr  r  r  r  r  r@   r@   rA   subplot2grid_  s"    )
r!  c             C   s   | dkrt  } | j }|S )a
  
    Make and return a second axes that shares the *x*-axis.  The new axes will
    overlay *ax* (or the current axes if *ax* is *None*), and its ticks will be
    on the right.

    Examples
    --------
    :doc:`/gallery/subplots_axes_and_figures/two_scales`
    N)r  twinx)r  ax1r@   r@   rA   r"    s    
r"  c             C   s   | dkrt  } | j }|S )a  
    Make and return a second axes that shares the *y*-axis.  The new axes will
    overlay *ax* (or the current axes if *ax* is *None*), and its ticks will be
    on the top.

    Examples
    --------
    :doc:`/gallery/subplots_axes_and_figures/two_scales`
    N)r  twiny)r  r#  r@   r@   rA   r$    s    
r$  c          
   C   sb   | dkrt  } tddi td
d}W dQ R X |jdd t| jd	rXtjj| jj	 t
| |S )zy
    Launch a subplot tool window for a figure.

    A :class:`matplotlib.widgets.SubplotTool` instance is returned.
    NZtoolbarNone   r   )r   g?)topr   )r&  r   )r{   r   r   subplots_adjustr   r   r   r   r  r   r%   )Z	targetfigZtoolfigr@   r@   rA   subplot_tool  s    r)  padHzG?c             C   s   t  j| |||d dS )a6  
    Adjust the padding between and around subplots.

    Parameters
    ----------
    pad : float, default: 1.08
        Padding between the figure edge and the edges of subplots,
        as a fraction of the font size.
    h_pad, w_pad : float, default: *pad*
        Padding (height/width) between edges of adjacent subplots,
        as a fraction of the font size.
    rect : tuple (left, bottom, right, top), default: (0, 0, 1, 1)
        A rectangle in normalized figure coordinates into which the whole
        subplots area (including labels) will fit.
    )r*  h_padw_padrectN)r{   tight_layout)r*  r,  r-  r.  r@   r@   rA   r/    s    r/  c             C   s&   t  }| dkr|j  } |j|  dS )a@  
    Turn the axes box on or off on the current axes.

    Parameters
    ----------
    on : bool or None
        The new `~matplotlib.axes.Axes` box state. If ``None``, toggle
        the state.

    See Also
    --------
    :meth:`matplotlib.axes.Axes.set_frame_on`
    :meth:`matplotlib.axes.Axes.get_frame_on`
    N)r  Zget_frame_onZset_frame_on)onr  r@   r@   rA   box  s    
r1  c              O   s*   t  }|  r| r|j S |j| |}|S )a  
    Get or set the x limits of the current axes.

    Call signatures::

        left, right = xlim()  # return the current xlim
        xlim((left, right))   # set the xlim to left, right
        xlim(left, right)     # set the xlim to left, right

    If you do not specify args, you can pass *left* or *right* as kwargs,
    i.e.::

        xlim(right=3)  # adjust the right leaving left unchanged
        xlim(left=1)  # adjust the left leaving right unchanged

    Setting limits turns autoscaling off for the x-axis.

    Returns
    -------
    left, right
        A tuple of the new x-axis limits.

    Notes
    -----
    Calling this function with no arguments (e.g. ``xlim()``) is the pyplot
    equivalent of calling `~.Axes.get_xlim` on the current axes.
    Calling this function with arguments is the pyplot equivalent of calling
    `~.Axes.set_xlim` on the current axes. All arguments are passed though.
    )r  Zget_xlimZset_xlim)ry   r\   r  retr@   r@   rA   xlim  s
    r3  c              O   s*   t  }|  r| r|j S |j| |}|S )a  
    Get or set the y-limits of the current axes.

    Call signatures::

        bottom, top = ylim()  # return the current ylim
        ylim((bottom, top))   # set the ylim to bottom, top
        ylim(bottom, top)     # set the ylim to bottom, top

    If you do not specify args, you can alternatively pass *bottom* or
    *top* as kwargs, i.e.::

        ylim(top=3)  # adjust the top leaving bottom unchanged
        ylim(bottom=1)  # adjust the bottom leaving top unchanged

    Setting limits turns autoscaling off for the y-axis.

    Returns
    -------
    bottom, top
        A tuple of the new y-axis limits.

    Notes
    -----
    Calling this function with no arguments (e.g. ``ylim()``) is the pyplot
    equivalent of calling `~.Axes.get_ylim` on the current axes.
    Calling this function with arguments is the pyplot equivalent of calling
    `~.Axes.set_ylim` on the current axes. All arguments are passed though.
    )r  Zget_ylimZset_ylim)ry   r\   r  r2  r@   r@   rA   ylim!  s
    r4  c             K   sr   t  }| dkr(|j }|dk	r2tdn
|j| }|dkrD|j }n|j|f|}x|D ]}|j| qXW ||fS )a  
    Get or set the current tick locations and labels of the x-axis.

    Pass no arguments to return the current values without modifying them.

    Parameters
    ----------
    ticks : array-like, optional
        The list of xtick locations.  Passing an empty list removes all xticks.
    labels : array-like, optional
        The labels to place at the given *ticks* locations.  This argument can
        only be passed if *ticks* is passed as well.
    **kwargs
        `.Text` properties can be used to control the appearance of the labels.

    Returns
    -------
    locs
        The list of xtick locations.
    labels
        The list of xlabel `.Text` objects.

    Notes
    -----
    Calling this function with no arguments (e.g. ``xticks()``) is the pyplot
    equivalent of calling `~.Axes.get_xticks` and `~.Axes.get_xticklabels` on
    the current axes.
    Calling this function with arguments is the pyplot equivalent of calling
    `~.Axes.set_xticks` and `~.Axes.set_xticklabels` on the current axes.

    Examples
    --------
    >>> locs, labels = xticks()  # Get the current locations and labels.
    >>> xticks(np.arange(0, 1, step=0.2))  # Set label locations.
    >>> xticks(np.arange(3), ['Tom', 'Dick', 'Sue'])  # Set text labels.
    >>> xticks([0, 1, 2], ['January', 'February', 'March'],
    ...        rotation=20)  # Set text labels and properties.
    >>> xticks([])  # Disable xticks.
    NzAxticks(): Parameter 'labels' can't be set without setting 'ticks')r  Z
get_xticksr   Z
set_xticksZget_xticklabelsZset_xticklabelsr   )tickslabelsr\   r  locslr@   r@   rA   xticksF  s    (



r9  c             K   sr   t  }| dkr(|j }|dk	r2tdn
|j| }|dkrD|j }n|j|f|}x|D ]}|j| qXW ||fS )a  
    Get or set the current tick locations and labels of the y-axis.

    Pass no arguments to return the current values without modifying them.

    Parameters
    ----------
    ticks : array-like, optional
        The list of ytick locations.  Passing an empty list removes all yticks.
    labels : array-like, optional
        The labels to place at the given *ticks* locations.  This argument can
        only be passed if *ticks* is passed as well.
    **kwargs
        `.Text` properties can be used to control the appearance of the labels.

    Returns
    -------
    locs
        The list of ytick locations.
    labels
        The list of ylabel `.Text` objects.

    Notes
    -----
    Calling this function with no arguments (e.g. ``yticks()``) is the pyplot
    equivalent of calling `~.Axes.get_yticks` and `~.Axes.get_yticklabels` on
    the current axes.
    Calling this function with arguments is the pyplot equivalent of calling
    `~.Axes.set_yticks` and `~.Axes.set_yticklabels` on the current axes.

    Examples
    --------
    >>> locs, labels = yticks()  # Get the current locations and labels.
    >>> yticks(np.arange(0, 1, step=0.2))  # Set label locations.
    >>> yticks(np.arange(3), ['Tom', 'Dick', 'Sue'])  # Set text labels.
    >>> yticks([0, 1, 2], ['January', 'February', 'March'],
    ...        rotation=45)  # Set text labels and properties.
    >>> yticks([])  # Disable yticks.
    NzAyticks(): Parameter 'labels' can't be set without setting 'ticks')r  Z
get_yticksr   Z
set_yticksZget_yticklabelsZset_yticklabelsr   )r5  r6  r\   r  r7  r8  r@   r@   rA   yticks  s    (



r:  c             K   st   t  }t|tstdtdd | |||gD rN| rN|jj }|jj }n|j| f|||d|\}}||fS )a  
    Get or set the radial gridlines on the current polar plot.

    Call signatures::

     lines, labels = rgrids()
     lines, labels = rgrids(radii, labels=None, angle=22.5, fmt=None, **kwargs)

    When called with no arguments, `.rgrids` simply returns the tuple
    (*lines*, *labels*). When called with arguments, the labels will
    appear at the specified radial distances and angle.

    Parameters
    ----------
    radii : tuple with floats
        The radii for the radial gridlines

    labels : tuple with strings or None
        The labels to use at each radial gridline. The
        `matplotlib.ticker.ScalarFormatter` will be used if None.

    angle : float
        The angular position of the radius labels in degrees.

    fmt : str or None
        Format string used in `matplotlib.ticker.FormatStrFormatter`.
        For example '%f'.

    Returns
    -------
    lines : list of `.lines.Line2D`
        The radial gridlines.

    labels : list of `.text.Text`
        The tick labels.

    Other Parameters
    ----------------
    **kwargs
        *kwargs* are optional `~.Text` properties for the labels.

    See Also
    --------
    .pyplot.thetagrids
    .projections.polar.PolarAxes.set_rgrids
    .Axis.get_gridlines
    .Axis.get_ticklabels

    Examples
    --------
    ::

      # set the locations of the radial gridlines
      lines, labels = rgrids( (0.25, 0.5, 1.0) )

      # set the locations and labels of the radial gridlines
      lines, labels = rgrids( (0.25, 0.5, 1.0), ('Tom', 'Dick', 'Harry' ))
    z"rgrids only defined for polar axesc             s   s   | ]}|d kV  qd S )Nr@   )rF   rC   r@   r@   rA   	<genexpr>  s    zrgrids.<locals>.<genexpr>)r6  anglefmt)	r  r   r   r   r   ZyaxisZget_gridlinesget_ticklabelsZ
set_rgrids)Zradiir6  r<  r=  r\   r  linesr@   r@   rA   rgrids  s    ;
 
r@  c             K   sp   t  }t|tstdtdd | ||gD rL| rL|jj }|jj }n|j| f||d|\}}||fS )a  
    Get or set the theta gridlines on the current polar plot.

    Call signatures::

     lines, labels = thetagrids()
     lines, labels = thetagrids(angles, labels=None, fmt=None, **kwargs)

    When called with no arguments, `.thetagrids` simply returns the tuple
    (*lines*, *labels*). When called with arguments, the labels will
    appear at the specified angles.

    Parameters
    ----------
    angles : tuple with floats, degrees
        The angles of the theta gridlines.

    labels : tuple with strings or None
        The labels to use at each radial gridline. The
        `.projections.polar.ThetaFormatter` will be used if None.

    fmt : str or None
        Format string used in `matplotlib.ticker.FormatStrFormatter`.
        For example '%f'. Note that the angle in radians will be used.

    Returns
    -------
    lines : list of `.lines.Line2D`
        The theta gridlines.

    labels : list of `.text.Text`
        The tick labels.

    Other Parameters
    ----------------
    **kwargs
        *kwargs* are optional `~.Text` properties for the labels.

    See Also
    --------
    .pyplot.rgrids
    .projections.polar.PolarAxes.set_thetagrids
    .Axis.get_gridlines
    .Axis.get_ticklabels

    Examples
    --------
    ::

      # set the locations of the angular gridlines
      lines, labels = thetagrids(range(45, 360, 90))

      # set the locations and labels of the angular gridlines
      lines, labels = thetagrids(range(45, 360, 90), ('NE', 'NW', 'SW', 'SE'))
    z&thetagrids only defined for polar axesc             s   s   | ]}|d kV  qd S )Nr@   )rF   paramr@   r@   rA   r;  @  s    zthetagrids.<locals>.<genexpr>)r6  r=  )	r  r   r   r   r   ZxaxisZget_ticklinesr>  Zset_thetagrids)Zanglesr6  r=  r\   r  r?  r@   r@   rA   
thetagrids  s    8

rB  c               C   s   d S )Nr@   r@   r@   r@   rA   plottingL  s    rC  c            	      sL   ddddddddd	h	  t t O  tjtt fd
dt j D S )z<
    Get a sorted list of all of the plotting commands.
    	colormapscolorsr   r   get_plot_commandsr   ginputrC  waitforbuttonpressc             3   sB   | ]:\}}|j d  r| krtj|rtj|kr|V  qdS )_N)
startswithr   
isfunction	getmodule)rF   namer   )excludethis_moduler@   rA   r;  ]  s    
z$get_plot_commands.<locals>.<genexpr>)setrD  r   rL  rF  r   r   rR   r@   r@   )rN  rO  rA   rF  P  s    
rF  c               C   s
   t tjS )aN,  
    Matplotlib provides a number of colormaps, and others can be added using
    :func:`~matplotlib.cm.register_cmap`.  This function documents the built-in
    colormaps, and will also return a list of all registered colormaps if
    called.

    You can set the colormap for an image, pcolor, scatter, etc,
    using a keyword argument::

      imshow(X, cmap=cm.hot)

    or using the :func:`set_cmap` function::

      imshow(X)
      pyplot.set_cmap('hot')
      pyplot.set_cmap('jet')

    In interactive mode, :func:`set_cmap` will update the colormap post-hoc,
    allowing you to see which one works best for your data.

    All built-in colormaps can be reversed by appending ``_r``: For instance,
    ``gray_r`` is the reverse of ``gray``.

    There are several common color schemes used in visualization:

    Sequential schemes
      for unipolar data that progresses from low to high
    Diverging schemes
      for bipolar data that emphasizes positive or negative deviations from a
      central value
    Cyclic schemes
      for plotting values that wrap around at the endpoints, such as phase
      angle, wind direction, or time of day
    Qualitative schemes
      for nominal data that has no inherent ordering, where color is used
      only to distinguish categories

    Matplotlib ships with 4 perceptually uniform color maps which are
    the recommended color maps for sequential data:

      =========   ===================================================
      Colormap    Description
      =========   ===================================================
      inferno     perceptually uniform shades of black-red-yellow
      magma       perceptually uniform shades of black-red-white
      plasma      perceptually uniform shades of blue-red-yellow
      viridis     perceptually uniform shades of blue-green-yellow
      =========   ===================================================

    The following colormaps are based on the `ColorBrewer
    <https://colorbrewer2.org>`_ color specifications and designs developed by
    Cynthia Brewer:

    ColorBrewer Diverging (luminance is highest at the midpoint, and
    decreases towards differently-colored endpoints):

      ========  ===================================
      Colormap  Description
      ========  ===================================
      BrBG      brown, white, blue-green
      PiYG      pink, white, yellow-green
      PRGn      purple, white, green
      PuOr      orange, white, purple
      RdBu      red, white, blue
      RdGy      red, white, gray
      RdYlBu    red, yellow, blue
      RdYlGn    red, yellow, green
      Spectral  red, orange, yellow, green, blue
      ========  ===================================

    ColorBrewer Sequential (luminance decreases monotonically):

      ========  ====================================
      Colormap  Description
      ========  ====================================
      Blues     white to dark blue
      BuGn      white, light blue, dark green
      BuPu      white, light blue, dark purple
      GnBu      white, light green, dark blue
      Greens    white to dark green
      Greys     white to black (not linear)
      Oranges   white, orange, dark brown
      OrRd      white, orange, dark red
      PuBu      white, light purple, dark blue
      PuBuGn    white, light purple, dark green
      PuRd      white, light purple, dark red
      Purples   white to dark purple
      RdPu      white, pink, dark purple
      Reds      white to dark red
      YlGn      light yellow, dark green
      YlGnBu    light yellow, light green, dark blue
      YlOrBr    light yellow, orange, dark brown
      YlOrRd    light yellow, orange, dark red
      ========  ====================================

    ColorBrewer Qualitative:

    (For plotting nominal data, `.ListedColormap` is used,
    not `.LinearSegmentedColormap`.  Different sets of colors are
    recommended for different numbers of categories.)

    * Accent
    * Dark2
    * Paired
    * Pastel1
    * Pastel2
    * Set1
    * Set2
    * Set3

    A set of colormaps derived from those of the same name provided
    with Matlab are also included:

      =========   =======================================================
      Colormap    Description
      =========   =======================================================
      autumn      sequential linearly-increasing shades of red-orange-yellow
      bone        sequential increasing black-white color map with
                  a tinge of blue, to emulate X-ray film
      cool        linearly-decreasing shades of cyan-magenta
      copper      sequential increasing shades of black-copper
      flag        repetitive red-white-blue-black pattern (not cyclic at
                  endpoints)
      gray        sequential linearly-increasing black-to-white
                  grayscale
      hot         sequential black-red-yellow-white, to emulate blackbody
                  radiation from an object at increasing temperatures
      jet         a spectral map with dark endpoints, blue-cyan-yellow-red;
                  based on a fluid-jet simulation by NCSA [#]_
      pink        sequential increasing pastel black-pink-white, meant
                  for sepia tone colorization of photographs
      prism       repetitive red-yellow-green-blue-purple-...-green pattern
                  (not cyclic at endpoints)
      spring      linearly-increasing shades of magenta-yellow
      summer      sequential linearly-increasing shades of green-yellow
      winter      linearly-increasing shades of blue-green
      =========   =======================================================

    A set of palettes from the `Yorick scientific visualisation
    package <https://dhmunro.github.io/yorick-doc/>`_, an evolution of
    the GIST package, both by David H. Munro are included:

      ============  =======================================================
      Colormap      Description
      ============  =======================================================
      gist_earth    mapmaker's colors from dark blue deep ocean to green
                    lowlands to brown highlands to white mountains
      gist_heat     sequential increasing black-red-orange-white, to emulate
                    blackbody radiation from an iron bar as it grows hotter
      gist_ncar     pseudo-spectral black-blue-green-yellow-red-purple-white
                    colormap from National Center for Atmospheric
                    Research [#]_
      gist_rainbow  runs through the colors in spectral order from red to
                    violet at full saturation (like *hsv* but not cyclic)
      gist_stern    "Stern special" color table from Interactive Data
                    Language software
      ============  =======================================================

    A set of cyclic color maps:

      ================  =================================================
      Colormap          Description
      ================  =================================================
      hsv               red-yellow-green-cyan-blue-magenta-red, formed by
                        changing the hue component in the HSV color space
      twilight          perceptually uniform shades of
                        white-blue-black-red-white
      twilight_shifted  perceptually uniform shades of
                        black-blue-white-red-black
      ================  =================================================

    Other miscellaneous schemes:

      ============= =======================================================
      Colormap      Description
      ============= =======================================================
      afmhot        sequential black-orange-yellow-white blackbody
                    spectrum, commonly used in atomic force microscopy
      brg           blue-red-green
      bwr           diverging blue-white-red
      coolwarm      diverging blue-gray-red, meant to avoid issues with 3D
                    shading, color blindness, and ordering of colors [#]_
      CMRmap        "Default colormaps on color images often reproduce to
                    confusing grayscale images. The proposed colormap
                    maintains an aesthetically pleasing color image that
                    automatically reproduces to a monotonic grayscale with
                    discrete, quantifiable saturation levels." [#]_
      cubehelix     Unlike most other color schemes cubehelix was designed
                    by D.A. Green to be monotonically increasing in terms
                    of perceived brightness. Also, when printed on a black
                    and white postscript printer, the scheme results in a
                    greyscale with monotonically increasing brightness.
                    This color scheme is named cubehelix because the (r, g, b)
                    values produced can be visualised as a squashed helix
                    around the diagonal in the (r, g, b) color cube.
      gnuplot       gnuplot's traditional pm3d scheme
                    (black-blue-red-yellow)
      gnuplot2      sequential color printable as gray
                    (black-blue-violet-yellow-white)
      ocean         green-blue-white
      rainbow       spectral purple-blue-green-yellow-orange-red colormap
                    with diverging luminance
      seismic       diverging blue-white-red
      nipy_spectral black-purple-blue-green-yellow-red-white spectrum,
                    originally from the Neuroimaging in Python project
      terrain       mapmaker's colors, blue-green-yellow-brown-white,
                    originally from IGOR Pro
      turbo         Spectral map (purple-blue-green-yellow-orange-red) with
                    a bright center and darker endpoints. A smoother
                    alternative to jet.
      ============= =======================================================

    The following colormaps are redundant and may be removed in future
    versions.  It's recommended to use the names in the descriptions
    instead, which produce identical output:

      =========  =======================================================
      Colormap   Description
      =========  =======================================================
      gist_gray  identical to *gray*
      gist_yarg  identical to *gray_r*
      binary     identical to *gray_r*
      =========  =======================================================

    .. rubric:: Footnotes

    .. [#] Rainbow colormaps, ``jet`` in particular, are considered a poor
      choice for scientific visualization by many researchers: `Rainbow Color
      Map (Still) Considered Harmful
      <https://ieeexplore.ieee.org/document/4118486/?arnumber=4118486>`_

    .. [#] Resembles "BkBlAqGrYeOrReViWh200" from NCAR Command
      Language. See `Color Table Gallery
      <https://www.ncl.ucar.edu/Document/Graphics/color_table_gallery.shtml>`_

    .. [#] See `Diverging Color Maps for Scientific Visualization
      <http://www.kennethmoreland.com/color-maps/>`_ by Kenneth Moreland.

    .. [#] See `A Color Map for Effective Black-and-White Rendering of
      Color-Scale Images
      <https://www.mathworks.com/matlabcentral/fileexchange/2662-cmrmap-m>`_
      by Carey Rappaport
    )r   r   Z_cmap_registryr@   r@   r@   rA   rD  c  s     urD  c        	         s   t  } tjdtjd}g }td tdx| D ]x}t | j}d}|dk	rv|j|}|dk	rvtj	|j
djdd	}d
| }|j||g t t| tt|q0W d  d	 d  }|djd d|g fdd|D  |g }dj|t_dS )z
    Generate the plotting docstring.

    These must be done after the entire module is imported, so it is
    called from the end of this module, which is generated by
    boilerplate.py.
    z(?:\s*).+?\.(?:\s+|$))flagsZFunctionDescriptionr=   Nr   
 z`%s`=z{:{}} {:{}}c                s    g | ]\}}d j | |qS )z{:{}} {:{}})r   )rF   rM  summary)max_namemax_summaryr@   rA   r   }  s   z1_setup_pyplot_info_docstrings.<locals>.<listcomp>)rF  recompileDOTALLr   r   __doc__r~   r   cleandocr   replacerY   r   r   joinrC  )	commandsZfirst_sentenceZrowsrM  docrV  r~   	separatorr?  r@   )rW  rX  rA   _setup_pyplot_info_docstringsZ  s(    

(rc  c             K   sJ   | d krt  } | d krtd|d kr,t }t j| f||d|}|S )NzNo mappable was found to use for colorbar creation. First define a mappable such as an image (with imshow) or a contour set (with contourf).)caxr  )gcir   r  r{   colorbar)Zmappablerd  r  kwr2  r@   r@   rA   rf    s    rf  c             C   s&   t  }|dkrtd|j| | dS )a[  
    Set the color limits of the current image.

    If either *vmin* or *vmax* is None, the image min/max respectively
    will be used for color scaling.

    If you want to set the clim of multiple images, use
    `~.ScalarMappable.set_clim` on every image, for example::

      for im in gca().get_images():
          im.set_clim(0, 0.5)

    Nz1You must first define an image, e.g., with imshow)re  r   Zset_clim)vminvmaximr@   r@   rA   clim  s    rk  c             C   s4   t j| } td| jd t }|dk	r0|j|  dS )aD  
    Set the default colormap, and applies it to the current image if any.

    Parameters
    ----------
    cmap : `~matplotlib.colors.Colormap` or str
        A colormap instance or the name of a registered colormap.

    See Also
    --------
    colormaps
    matplotlib.cm.register_cmap
    matplotlib.cm.get_cmap
    image)cmapN)r   r   r   rM  re  set_cmap)rm  rj  r@   r@   rA   rn    s
    
rn  c             C   s   t jj| |S )N)rc   rl  imread)r   r   r@   r@   rA   ro    s    ro  c             K   s   t jj| |f|S )N)rc   rl  imsave)r   Zarrr\   r@   r@   rA   rp    s    rp  c             K   sV   t j| } |dkrt }n"t|t| d}|jddddg}|j| f|}t| |S )ad  
    Display an array as a matrix in a new figure window.

    The origin is set at the upper left hand corner and rows (first
    dimension of the array) are displayed horizontally.  The aspect
    ratio of the figure window is that of the array, unless this would
    make an excessively short or narrow figure.

    Tick labels for the xaxis are placed on top.

    Parameters
    ----------
    A : array-like(M, N)
        The matrix to be displayed.

    fignum : None or int or False
        If *None*, create a new figure window with automatic numbering.

        If a nonzero integer, draw into the figure with the given number
        (create it if it does not exist).

        If 0, use the current axes (or create one if it does not exist).

        .. note::

           Because of how `.Axes.matshow` tries to set the figure aspect
           ratio to be the one of the array, strange things may happen if you
           reuse an existing figure.

    Returns
    -------
    `~matplotlib.image.AxesImage`

    Other Parameters
    ----------------
    **kwargs : `~matplotlib.axes.Axes.imshow` arguments

    r   )r   g333333?g
ףp=
?g?)npZ
asanyarrayr  r   r   r   matshowsci)AZfignumr\   r  r   rj  r@   r@   rA   rr    s    '
rr  c              O   s:   t  j r tt ts tjd tdd}|j| |}|S )z
    Make a polar plot.

    call signature::

      polar(theta, r, **kwargs)

    Multiple *theta*, *r* arguments are supported, with format strings, as in
    `plot`.
    zMTrying to create polar plot on an axis that does not have a polar projection.T)polar)r{   Zget_axesr   r  r   r   r   plot)ry   r\   r  r2  r@   r@   rA   ru  	  s    


ru  Zbackend_fallbackr   ZWebAggZnbAggc
             K   s(   t  j| f|||||||||	d	|
S )N)	xoyoalphanormrm  rh  ri  originresize)r{   figimage)Xrw  rx  ry  rz  rm  rh  ri  r{  r|  r\   r@   r@   rA   r}  .	  s    r}  c             K   s   t  j| ||fd|i|S )Nfontdict)r{   text)xyr   r  r\   r@   r@   rA   figtext8	  s    r  c              K   s   t  jf | S )N)r{   r  )r\   r@   r@   rA   r  >	  s    r  c               C   s
   t  j S )N)r{   _gcir@   r@   r@   rA   re  D	  s    re     c             C   s   t  j| |||||dS )N)ntimeoutshow_clicks	mouse_add	mouse_pop
mouse_stop)r{   rG  )r  r  r  r  r  r  r@   r@   rA   rG  J	  s    rG  c             C   s   t  j| |||||dS )N)leftbottomrightr'  wspacehspace)r{   r(  )r  r  r  r'  r  r  r@   r@   rA   r(  V	  s    
r(  c             K   s   t  j| f|S )N)r{   suptitle)tr\   r@   r@   rA   r  `	  s    r  c             C   s   t  j| dS )N)r  )r{   rH  )r  r@   r@   rA   rH  f	  s    rH  )datac            K   s$   t  j| f|d k	rd|ini |S )Nr  )r  acorr)r  r  r\   r@   r@   rA   r  l	  s    r  c            K   s2   t  j| f|||||d|d k	r(d|ini |S )N)FsFcwindowpad_tosidesr  )r  angle_spectrum)r  r  r  r  r  r  r  r\   r@   r@   rA   r  s	  s    r  c             O   s   t  j| |f||S )N)r  annotate)r  Zxyry   r\   r@   r@   rA   r  }	  s    r  c             K   s   t  j| |||f|S )N)r  arrow)r  r  ZdxZdyr\   r@   r@   rA   r  	  s    r  bothc             C   s   t  j| ||dS )N)enableaxistight)r  	autoscale)r  r  r  r@   r@   rA   r  	  s    r  c             K   s   t  jf | ||d|S )N)r  xminxmax)r  axhline)r  r  r  r\   r@   r@   rA   r  	  s    r  c             K   s   t  j| |f||d|S )N)r  r  )r  axhspan)yminymaxr  r  r\   r@   r@   rA   r  	  s    r  )emitc             O   s   t  j|d| i|S )Nr  )r  r  )r  ry   r\   r@   r@   rA   r  	  s    r  )slopec            K   s   t  j| f||d|S )N)xy2r  )r  axline)Zxy1r  r  r\   r@   r@   rA   r  	  s    r  c             K   s   t  jf | ||d|S )N)r  r  r  )r  axvline)r  r  r  r\   r@   r@   rA   r  	  s    r  c             K   s   t  j| |f||d|S )N)r  r  )r  axvspan)r  r  r  r  r\   r@   r@   rA   r  	  s    r  皙?center)alignr  c            K   s0   t  j| |f|||d|d k	r&d|ini |S )N)widthr  r  r  )r  bar)r  heightr  r  r  r  r\   r@   r@   rA   r  	  s    r  c             O   s"   t  j|| d k	rd| ini |S )Nr  )r  barbs)r  ry   rg  r@   r@   rA   r  	  s    r  )r  c            K   s   t  j| |f|||d|S )N)r  r  r  )r  barh)r  r  r  r  r  r\   r@   r@   rA   r  	  s    r  c            C   sX   t  j| f|||||||||	|
|||||||||||||||d|d k	rPd|ini S )N)notchsymvertwhis	positionswidthspatch_artist	bootstrapusermediansconf_intervalsmeanline	showmeansshowcapsshowbox
showfliersboxpropsr6  
flierpropsmedianprops	meanpropscappropswhiskerpropsmanage_ticks	autorangezorderr  )r  boxplot)r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r6  r  r  r  r  r  r  r  r  r  r@   r@   rA   r  	  s    
r  c            K   s&   t  j| |f|d k	rd|ini |S )Nr  )r  broken_barh)ZxrangesZyranger  r\   r@   r@   rA   r  	  s    r  c               C   s
   t  j S )N)r  clar@   r@   r@   rA   r  	  s    r  c             K   s   t  j| fd|i|S )Nlevels)r  clabel)CSr  r\   r@   r@   rA   r  	  s    r     defaultc            K   s<   t  j| |f||||||||	|
d	|d k	r2d|ini |S )N)	NFFTr  r  detrendr  noverlapr  r  scale_by_freqr  )r  cohere)r  r  r  r  r  r  r  r  r  r  r  r  r\   r@   r@   rA   r  	  s
    r  c             O   s8   t  j|| d k	rd| ini |}|jd k	r4t| |S )Nr  )r  contour_Ars  )r  ry   r\   __retr@   r@   rA   r  
  s    
 r  c             O   s8   t  j|| d k	rd| ini |}|jd k	r4t| |S )Nr  )r  contourfr  rs  )r  ry   r\   r  r@   r@   rA   r  
  s    
 r  c            K   s>   t  j| |f||||||||	|
|d
|d k	r4d|ini |S )N)
r  r  r  r  r  r  r  r  r  return_liner  )r  csd)r  r  r  r  r  r  r  r  r  r  r  r  r  r\   r@   r@   rA   r  
  s
    r  c            K   sD   t  j| |f||||||||	|
||||d|d k	r:d|ini |S )N)yerrxerrr=  ecolor
elinewidthcapsize	barsabovelolimsuplimsxlolimsxuplims
erroreverycapthickr  )r  errorbar)r  r  r  r  r=  r  r  r  r  r  r  r  r  r  r  r  r\   r@   r@   rA   r  &
  s    
r  
horizontalsolidc      	   	   K   s4   t  j| f||||||d|d k	r*d|ini |S )N)orientationlineoffsetslinelengths
linewidthsrE  
linestylesr  )r  	eventplot)	r  r  r  r  r  rE  r  r  r\   r@   r@   rA   r  5
  s
    r  c             O   s"   t  j|| d k	rd| ini |S )Nr  )r  fill)r  ry   r\   r@   r@   rA   r  B
  s    r  c            K   s2   t  j| |f||||d|d k	r(d|ini |S )N)y2whereinterpolatestepr  )r  fill_between)r  y1r  r  r  r  r  r\   r@   r@   rA   r  J
  s    r  c            K   s2   t  j| |f||||d|d k	r(d|ini |S )N)x2r  r  r  r  )r  fill_betweenx)r  x1r  r  r  r  r  r\   r@   r@   rA   r  T
  s    r  majorc             K   s   t  jf | ||d|S )N)bwhichr  )r  grid)r  r  r  r\   r@   r@   rA   r  ^
  s    r  Zlinearfacec            K   sV   t  j| |f||||||||	|
|||||||d|d k	r@d|ini |}t| |S )N)Cgridsizebinsxscaleyscaleextentrm  rz  rh  ri  ry  r  
edgecolorsreduce_C_functionmincnt	marginalsr  )r  hexbinrs  )r  r  r  r  r  r  r	  r
  rm  rz  rh  ri  ry  r  r  r  r  r  r  r\   r  r@   r@   rA   r  d
  s    
r  midverticalc            K   sD   t  j| f|||||||||	|
||||d|d k	r:d|ini |S )N)r  rangedensityweights
cumulativer  histtyper  r  rwidthlogcolorlabelstackedr  )r  hist)r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r\   r@   r@   rA   r  w
  s    
r  
   c         	   K   sF   t  j| |f||||||d|d k	r,d|ini |	}
t|
d  |
S )N)r  r  r  r  cmincmaxr  r)   rK   )r  hist2drs  )r  r  r  r  r  r  r  r  r  r\   r  r@   r@   rA   r   
  s    
r   c            K   s2   t  j| ||f|||d|d k	r(d|ini |S )N)rE  r  r  r  )r  hlines)r  r  r  rE  r  r  r  r\   r@   r@   rA   r!  
  s    r!        @)
filternorm	filterradresampleurlr  c
            K   sN   t  j| f|||||||||	|
|||d|d k	r8d|ini |}t| |S )N)rm  rz  aspectinterpolationry  rh  ri  r{  r
  r#  r$  r%  r&  r  )r  imshowrs  )r~  rm  rz  r'  r(  ry  rh  ri  r{  r
  r#  r$  r%  r&  r  r\   r  r@   r@   rA   r)  
  s    
r)  c              O   s   t  j| |S )N)r  r   )ry   r\   r@   r@   rA   r   
  s    r   c             K   s   t  jf | |d|S )N)r  r  )r  locator_params)r  r  r\   r@   r@   rA   r*  
  s    r*  c              O   s   t  j| |S )N)r  loglog)ry   r\   r@   r@   rA   r+  
  s    r+  c      	   	   K   s4   t  j| f||||||d|d k	r*d|ini |S )N)r  r  r  r  r  r   r  )r  magnitude_spectrum)	r  r  r  r  r  r  r   r  r\   r@   r@   rA   r,  
  s    r,  )r  r  r  c             G   s   t  j|| ||dS )N)r  r  r  )r  margins)r  r  r  r-  r@   r@   rA   r-  
  s    r-  c               C   s
   t  j S )N)r  minorticks_offr@   r@   r@   rA   r.  
  s    r.  c               C   s
   t  j S )N)r  minorticks_onr@   r@   r@   rA   r/  
  s    r/  )shadingry  rz  rm  rh  ri  r  c       
   	   O   s>   t  j|| |||||d|d k	r(d|ini |}	t|	 |	S )N)r0  ry  rz  rm  rh  ri  r  )r  pcolorrs  )
r0  ry  rz  rm  rh  ri  r  ry   r\   r  r@   r@   rA   r1  
  s    
r1  )ry  rz  rm  rh  ri  r0  antialiasedr  c          
   O   s@   t  j|| ||||||d|d k	r*d|ini |	}
t|
 |
S )N)ry  rz  rm  rh  ri  r0  r2  r  )r  
pcolormeshrs  )ry  rz  rm  rh  ri  r0  r2  r  ry   r\   r  r@   r@   rA   r3  
  s    

r3  c            K   s2   t  j| f|||||d|d k	r(d|ini |S )N)r  r  r  r  r  r  )r  phase_spectrum)r  r  r  r  r  r  r  r\   r@   r@   rA   r4  
  s    r4  333333?皙?)	normalizer  c            C   sF   t  j| f|||||||||	|
||||||d|d k	r>d|ini S )N)exploder6  rE  autopctpctdistanceshadowlabeldistance
startangleradiuscounterclock
wedgeprops	textpropsr  framerotatelabelsr7  r  )r  pie)r  r8  r6  rE  r9  r:  r;  r<  r=  r>  r?  r@  rA  r  rB  rC  r7  r  r@   r@   rA   rD    s    

rD  )scalexscaleyr  c             O   s*   t  j|| |d|d k	r d|ini |S )N)rE  rF  r  )r  rv  )rE  rF  r  ry   r\   r@   r@   rA   rv    s    
rv  r}   c            K   s2   t  j| |f||||d|d k	r(d|ini |S )N)r=  tzxdateydater  )r  	plot_date)r  r  r=  rG  rH  rI  r  r\   r@   r@   rA   rJ    s    rJ  c            K   s<   t  j| f|||||||||	|
d
|d k	r2d|ini |S )N)
r  r  r  r  r  r  r  r  r  r  r  )r  psd)r  r  r  r  r  r  r  r  r  r  r  r  r\   r@   r@   rA   rK  (  s
    rK  c             O   s.   t  j|| d k	rd| ini |}t| |S )Nr  )r  quiverrs  )r  ry   rg  r  r@   r@   rA   rL  5  s    rL  c             K   s   t  j| ||||f|S )N)r  	quiverkey)Qr~  YUr  rg  r@   r@   rA   rM  >  s    rM  )plotnonfiniter  c            K   sN   t  j| |f||||||||	|
|||d|d k	r8d|ini |}t| |S )N)r   cmarkerrm  rz  rh  ri  ry  r  vertsr  rQ  r  )r  scatterrs  )r  r  r   rR  rS  rm  rz  rh  ri  ry  r  rT  r  rQ  r  r\   r  r@   r@   rA   rU  D  s    rU  c              O   s   t  j| |S )N)r  semilogx)ry   r\   r@   r@   rA   rV  U  s    rV  c              O   s   t  j| |S )N)r  semilogy)ry   r\   r@   r@   rA   rW  [  s    rW  c            K   sV   t  j| f|||||||||	|
|||||d|d k	r<d|ini |}t|d  |S )N)r  r  r  r  r  r  rm  xextentr  r  r  moder   rh  ri  r  r)   rK   )r  specgramrs  )r  r  r  r  r  r  r  rm  rX  r  r  r  rY  r   rh  ri  r  r\   r  r@   r@   rA   rZ  a  s    
rZ  equalupperc             K   s8   t  j| f|||||d|}t|tjr4t| |S )N)	precisionrS  
markersizer'  r{  )r  spyr   r   ZScalarMappablers  )Zr]  rS  r^  r'  r{  r\   r  r@   r@   rA   r_  r  s    
 r_  Zzero)r6  rE  baseliner  c            O   s2   t  j| f||||d|d k	r(d|ini |S )N)r6  rE  ra  r  )r  	stackplot)r  r6  rE  ra  r  ry   r\   r@   r@   rA   rb  ~  s    rb  )linefmt	markerfmtbasefmtr  r  use_line_collectionr  c          	   G   s0   t  j|| |||||d|d k	r(d|ini S )N)rc  rd  re  r  r  rf  r  )r  stem)rc  rd  re  r  r  rf  r  ry   r@   r@   rA   rg    s
    rg  pre)r  r  c            O   s0   t  j| |f|d|i|d k	r&d|ini |S )Nr  r  )r  r  )r  r  r  r  ry   r\   r@   r@   rA   r    s    r  -|>皙?c            C   sT   t  j| |||f||||||	|
||||||d|d k	r>d|ini }t|j |S )N)r  r   r  rm  rz  	arrowsize
arrowstyle	minlength	transformr  start_points	maxlengthintegration_directionr  )r  
streamplotrs  r?  )r  r  urH   r  r   r  rm  rz  rk  rl  rm  rn  r  ro  rp  rq  r  r  r@   r@   rA   rr    s    
rr  r  r  r  closedc             K   s.   t  jf | |||||||||	|
||d|S )N)cellTextcellColourscellLoc	colWidths	rowLabels
rowColoursrowLoc	colLabels
colColourscolLocr  r  edges)r  table)ru  rv  rw  rx  ry  rz  r{  r|  r}  r~  r  r  r  r\   r@   r@   rA   r    s    r  c             K   s   t  j| ||fd|i|S )Nr  )r  r  )r  r  r   r  r\   r@   r@   rA   r    s    r  c             K   s   t  jf d| i|S )Nr  )r  tick_params)r  r\   r@   r@   rA   r    s    r  )r  r   	scilimits	useOffset	useLocaleuseMathTextc             C   s   t  j| |||||dS )N)r  r   r  r  r  r  )r  ticklabel_format)r  r   r  r  r  r  r@   r@   rA   r    s    r  c              O   s$   t  j| |}|jd k	r t| |S )N)r  
tricontourr  rs  )ry   r\   r  r@   r@   rA   r    s    
 r  c              O   s$   t  j| |}|jd k	r t| |S )N)r  tricontourfr  rs  )ry   r\   r  r@   r@   rA   r    s    
 r  g      ?Zflat)ry  rz  rm  rh  ri  r0  
facecolorsc       
   
   O   s.   t  j|| ||||||d|}	t|	 |	S )N)ry  rz  rm  rh  ri  r0  r  )r  	tripcolorrs  )
ry  rz  rm  rh  ri  r0  r  ry   r\   r  r@   r@   rA   r    s
    
r  c              O   s   t  j| |S )N)r  triplot)ry   r\   r@   r@   rA   r    s    r        ?c
            C   s8   t  j| f|||||||||	d	|
d k	r0d|
ini S )N)	r  r  r  r  showextremashowmedians	quantilespoints	bw_methodr  )r  
violinplot)Zdatasetr  r  r  r  r  r  r  r  r  r  r@   r@   rA   r    s    
r  c            K   s2   t  j| ||f|||d|d k	r(d|ini |S )N)rE  r  r  r  )r  vlines)r  r  r  rE  r  r  r  r\   r@   r@   rA   r    s    r  c            K   s2   t  j| |f||||d|d k	r(d|ini |S )N)normedr  	usevlinesmaxlagsr  )r  xcorr)r  r  r  r  r  r  r  r\   r@   r@   rA   r    s    r  c             C   s   t  j| S )N)r  _sci)rj  r@   r@   rA   rs    s    rs  )r  c            K   s   t  j| f||||d|S )N)r  r  r*  r  )r  	set_title)r  r  r  r*  r  r\   r@   r@   rA   title"  s    r  )r  c            K   s   t  j| f|||d|S )N)r  labelpadr  )r  
set_xlabel)xlabelr  r  r  r\   r@   r@   rA   r  )  s    r  c            K   s   t  j| f|||d|S )N)r  r  r  )r  
set_ylabel)ylabelr  r  r  r\   r@   r@   rA   r  1  s    r  c             K   s   t  j| f|S )N)r  
set_xscale)valuer\   r@   r@   rA   r  9  s    r  c             K   s   t  j| f|S )N)r  
set_yscale)r  r\   r@   r@   rA   r	  ?  s    r	  c               C   s   t d dS )z
    Set the colormap to "autumn".

    This changes the default colormap as well as the colormap of the current
    image if there is one. See ``help(colormaps)`` for more information.
    autumnN)rn  r@   r@   r@   rA   r  E  s    r  c               C   s   t d dS )z
    Set the colormap to "bone".

    This changes the default colormap as well as the colormap of the current
    image if there is one. See ``help(colormaps)`` for more information.
    boneN)rn  r@   r@   r@   rA   r  P  s    r  c               C   s   t d dS )z
    Set the colormap to "cool".

    This changes the default colormap as well as the colormap of the current
    image if there is one. See ``help(colormaps)`` for more information.
    coolN)rn  r@   r@   r@   rA   r  [  s    r  c               C   s   t d dS )z
    Set the colormap to "copper".

    This changes the default colormap as well as the colormap of the current
    image if there is one. See ``help(colormaps)`` for more information.
    copperN)rn  r@   r@   r@   rA   r  f  s    r  c               C   s   t d dS )z
    Set the colormap to "flag".

    This changes the default colormap as well as the colormap of the current
    image if there is one. See ``help(colormaps)`` for more information.
    flagN)rn  r@   r@   r@   rA   r  q  s    r  c               C   s   t d dS )z
    Set the colormap to "gray".

    This changes the default colormap as well as the colormap of the current
    image if there is one. See ``help(colormaps)`` for more information.
    grayN)rn  r@   r@   r@   rA   r  |  s    r  c               C   s   t d dS )z
    Set the colormap to "hot".

    This changes the default colormap as well as the colormap of the current
    image if there is one. See ``help(colormaps)`` for more information.
    hotN)rn  r@   r@   r@   rA   r    s    r  c               C   s   t d dS )z
    Set the colormap to "hsv".

    This changes the default colormap as well as the colormap of the current
    image if there is one. See ``help(colormaps)`` for more information.
    hsvN)rn  r@   r@   r@   rA   r    s    r  c               C   s   t d dS )z
    Set the colormap to "jet".

    This changes the default colormap as well as the colormap of the current
    image if there is one. See ``help(colormaps)`` for more information.
    jetN)rn  r@   r@   r@   rA   r    s    r  c               C   s   t d dS )z
    Set the colormap to "pink".

    This changes the default colormap as well as the colormap of the current
    image if there is one. See ``help(colormaps)`` for more information.
    pinkN)rn  r@   r@   r@   rA   r    s    r  c               C   s   t d dS )z
    Set the colormap to "prism".

    This changes the default colormap as well as the colormap of the current
    image if there is one. See ``help(colormaps)`` for more information.
    prismN)rn  r@   r@   r@   rA   r    s    r  c               C   s   t d dS )z
    Set the colormap to "spring".

    This changes the default colormap as well as the colormap of the current
    image if there is one. See ``help(colormaps)`` for more information.
    springN)rn  r@   r@   r@   rA   r    s    r  c               C   s   t d dS )z
    Set the colormap to "summer".

    This changes the default colormap as well as the colormap of the current
    image if there is one. See ``help(colormaps)`` for more information.
    summerN)rn  r@   r@   r@   rA   r    s    r  c               C   s   t d dS )z
    Set the colormap to "winter".

    This changes the default colormap as well as the colormap of the current
    image if there is one. See ``help(colormaps)`` for more information.
    winterN)rn  r@   r@   r@   rA   r    s    r  c               C   s   t d dS )z
    Set the colormap to "magma".

    This changes the default colormap as well as the colormap of the current
    image if there is one. See ``help(colormaps)`` for more information.
    magmaN)rn  r@   r@   r@   rA   r    s    r  c               C   s   t d dS )z
    Set the colormap to "inferno".

    This changes the default colormap as well as the colormap of the current
    image if there is one. See ``help(colormaps)`` for more information.
    infernoN)rn  r@   r@   r@   rA   r    s    r  c               C   s   t d dS )z
    Set the colormap to "plasma".

    This changes the default colormap as well as the colormap of the current
    image if there is one. See ``help(colormaps)`` for more information.
    plasmaN)rn  r@   r@   r@   rA   r    s    r  c               C   s   t d dS )z
    Set the colormap to "viridis".

    This changes the default colormap as well as the colormap of the current
    image if there is one. See ``help(colormaps)`` for more information.
    viridisN)rn  r@   r@   r@   rA   r     s    r  c               C   s   t d dS )z
    Set the colormap to "nipy_spectral".

    This changes the default colormap as well as the colormap of the current
    image if there is one. See ``help(colormaps)`` for more information.
    nipy_spectralN)rn  r@   r@   r@   rA   r    s    r  )N)NNT)NN)r)   r   r   )N)N)N)r)   r)   FFTNN)r)   r)   N)N)N)N)r+  NNN)N)NN)NN)NNNN)NNN)NNN)NN)N)N)	r   r   NNNNNNF)N)NNNNNNrK   )rK   )NNNNN)Tr  N)r   r   r)   )r   r)   )N)r   r   r)   )r   r)   )r  N)r  N)NNNNNNNNNNNNNNNNNNNNNNTFN)N)
NNNNNNNNNN)NNr=   NNNFFFFFr)   N)r  r)   r)   NNr  )r   NFN)r   NNF)Nr   r  )NNFNFNr  r  r  NFNNF)r  NFNNN)Nr  r=   )	NNNNNNNNN)r  N)NNNNNN)NNNNNr   r   )NNNNr5  Fr6  r   r)   TNNr  FF)r}   NTF)
NNNNNNNNNN)NNNNNNNNNNNNNNN)r   NNr[  r\  )r)   NNNNr)   ri  rj  NNNr"  r  )NNr  NNNr  NNr  r  Nrt  )N)r  )	NTr  FTFNr   N)Nr  r=   )NNN)NN)NN(+  r\  rL   r   r   loggingnumbersr   rY  ri   r   r   rq   dummy_threadingr   rc   Zmatplotlib.colorbarZmatplotlib.imager   r   r   r   r   r	   Zmatplotlib.backend_basesr
   r   Zmatplotlib.figurer   r   Zmatplotlib.gridspecr   r   r   r   r   Zmatplotlib.rcsetupr   Z_interactive_bkZmatplotlib.artistr   Zmatplotlib.axesr   r   Zmatplotlib.projectionsr   r   Zmatplotlib.scaler   r   Zmatplotlib.cmr   r   numpyrq  Zmatplotlib.colorsr   Zmatplotlib.linesr   Zmatplotlib.textr   r    Zmatplotlib.patchesr!   r"   r#   r$   Zmatplotlib.widgetsr%   r&   r'   r(   Ztickerr*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   	getLoggerr]   r   Z_rename_parameterrS   Z_make_keyword_onlyrQ   rN   rk   ro   rs   rw   r   re   wrapsrx   r|   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rp   r   r   r   r   r   r{   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r^  Zdedent_interpdr   r  r  r   r  r  r!  r"  r$  r)  r/  r1  r3  r4  r9  r:  r@  rB  rC  rF  rD  rc  rf  Zcolorbar_docrk  rn  rl  ro  rp  rr  ru  r   __getitem__rP  r   __setitem__r   r}  r  r  r  r  re  rG  LEFTRIGHTZMIDDLEr(  r  rH  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  Zdetrend_noneZwindow_hanningr  r  r  r  r  r  r  r  r  r  Zmeanr  r   r!  r)  r*  r+  r,  r-  r.  r/  r1  r3  r4  rD  rv  rJ  rK  rL  rM  rU  deprecationZ_deprecated_parameterrV  rW  rZ  r_  rb  rg  r  rr  r  r  r  r  r  r  r  r  r  r  r  rs  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@   r@   rA   <module>   s  T
5 W	 
$) *
]	 '
  	P>
%%<<GG x.

4


         
			  	   
  	


   
 
 
 
      	
    		

   
   


	
  





	