a
    Sic                    @   s^  d Z ddlmZ ddlmZ ddlZddlZddlZddlZddl	m
Z
 ddlZddlZddlZddlZddlmZ ddlZddlZddlZddlmZ ddl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m Z  ddl!m"Z"m#Z# ddlm$Z$m%Z%m&Z&m'Z' ddl(m)Z* ddl+m,Z, ddl-m.Z.m/Z/ ddl0m1Z1 ddlm2Z2 ddl3m4Z4 ddlm5Z5 ddl6m7Z8m9Z9 ddl:m;Z< ddl=Z>ddl:m?Z? ddl@mAZA ddlBmCZCmDZD ddlEmFZFmGZGmHZHmIZI ddlJmKZKmLZLmMZM ddlNmOZOmPZPmQZQmRZRmSZSmTZTmUZUmVZVmWZWmXZXmYZYmZZZm[Z[m\Z\m]Z]m^Z^m_Z_m`Z`maZa ebecZddd d!Zeed"g d#Zfefjgahd$d% Zid&d' Zjd(d) ZkejljmZmeeejnd*d+ Zneee,jodd-d.Zod/d0 Zpdaqd1d2 Zrd3d4 Zsd5d6 Ztd7d8 Zud9d: Zvd;d< Zwd=d> Zxd?d@ ZydAdB ZzdCdD Z{eeej|dEdF Z|eeej}ddGdHZ}eeej~dIdJ Z~eeejjdKdL ZeeejjdMdN ZeeejjdOdP ZddSdTZedUdVdddddd,edWfdXdYZdZd[ Zd\d] Zd^d_ Zd`da Zdbdc Zddde Zeeejdfdg Zeeejdhdi ZddjdkZdldm Zdndo Zeeejdpdq Zdrds Zejj r\ejj dtdue_ ejddvdwZddxdyZdzd{ Zd|d} Zejd~d ZddWdWd,dddddddZdWdWddddddddZdddZdddZdddZdddZdddZdd Zdd ZddWdddZddWdddZdddZdddZh dZdd ZeeejdddZdddZdddZe5jj e_ dd ZeeejjdddZeeejjdd ZdddZdd Ze$d r&e$ ee*ddh v r&e r&ee$dej eeejdddZeeejdddZeeejdd Zeeejdd Zeeejddd,ejejejfddZeeejƃdddZeeejǃddÄ ZeeejȃdddddŜddǄZeeejɃdddʄZeee.jʃdd˜dd̈́Zeee.j˃ddd˜ddτZeee.j̃ddd҄Zeee.j̓ddԄ Zeee.j΃dddׄZeee.jσdddلZeee.jЃdddۄZeee.jуd,dܜddބZeee.j҃dddߜddZeee.jӃdddZeee.jԃdddZeee.jՃddddddZeee.jփdd˜ddZeee.j׃ddddddZeee.j؃dddddddZeee.jكddd˜ddZeee.jڃdd˜ddZeee.jۃdddZeee.j܃ddRde2je2jddddf	dd˜ddZeee.j߃dd˜ddZeee.jdd˜d dZeee.jddd˜ddZeee.jddd˜ddZeee.jddd˜d	d
Zeee.jdd˜ddZeee.jddd˜ddZeee.jddd˜ddZeee.jdddZeee.jddQddddddddddde>jddWfdd˜ddZeee.jddd˜ddZeee.jddddWddddZeee.jddd˜d d!Zeee.jddd˜d"d#Zeee.jddd,d$dddd%d&d'Zeee.jd(d) Zeee.jdd*d+Zeee.jd,d- Zeee.jddd˜d.d/Zeee.jddd,d0d1d2Zeee.jd3d4 Zeee.jd5d6 Zeee.jdddddddd7d8d9Zeee.jdddddddWdd:d;d<Zeee.jddd˜d=d>Zeee.jdd,ddBdCdDZeee.jd,d,ddEdFdGZeee.jddd˜dIdJZeee.jddd˜dKdLZeee.jdd˜dMdNZeee.jdOdP Zeee.jdddWddQdRdSZeee.jdTdU Zeee.j dVdW Z eee.jddd˜dXdYZeee.jdd\d]Zeee.jd^dd_dd`dadbZeee.jdddddejjdddcdddeZeee.jdfddgdhdiZeee.jddd˜dldmZeee.j	ddrdsZ	eee.jddtduZeee.j
ddvdwZ
eee.jdՐddddddxdydzZeee.jd{d| Zeee.jd}d~ Zeee.jddddddddddZeee.jdd Zeee.jd dd˜ddZeee.jddd˜ddZeee.jd,e2jd,dfdd˜ddZeee.jdd Zeee.jdddddZeee.jdddddZeee.jdddddZeee.jdd Zeee.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 Z0dd Z1dS (  a  
`matplotlib.pyplot` is a state-based interface to matplotlib. It provides
an implicit,  MATLAB-like, way of plotting.  It also opens figures on your
screen, and acts as the figure GUI manager.

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 explicit object-oriented API is recommended for complex plots, though
pyplot is still usually used to create the figure and often the axes in the
figure. See `.pyplot.figure`, `.pyplot.subplots`, and
`.pyplot.subplot_mosaic` to create figures, and
:doc:`Axes API </api/axes_api>` for the plotting methods on an Axes::

    import numpy as np
    import matplotlib.pyplot as plt

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


See :ref:`api_interfaces` for an explanation of the tradeoffs between the
implicit and explicit interfaces.
    )	ExitStack)EnumN)Number)cycler)_api)rcsetupstyle)_pylab_helpersinteractive)cbook)
_docstring)FigureCanvasBaseMouseButton)Figure
FigureBase	figaspect)GridSpecSubplotSpec)rcParamsrcParamsDefaultget_backendrcParamsOrig)interactive_bk)Artist)AxesSubplot)	PolarAxes)mlab)get_scale_names)cm)
_colormapsregister_cmap)_color_sequences)	Normalize)Line2D)Text
Annotation)Polygon	RectangleCircleArrow)ButtonSliderWidget   )
TickHelper	FormatterFixedFormatterNullFormatterFuncFormatterFormatStrFormatterScalarFormatterLogFormatterLogFormatterExponentLogFormatterMathtextLocatorIndexLocatorFixedLocatorNullLocatorLinearLocator
LogLocatorAutoLocatorMultipleLocatorMaxNLocatorc                 C   st   |d u rt t| S t| g}t| dd d urTtjj	| }|rL|
| | j} q |d d d D ]}||}qb|S )N__wrapped__)	functoolspartial_copy_docstring_and_deprecatorsr   copygetattrr   deprecation
DECORATORSgetappendrB   )methodfunc
decorators	decorator rQ   M/var/www/html/django/DPS/env/lib/python3.9/site-packages/matplotlib/pyplot.pyrF   \   s    

rF   _ReplDisplayHook)NONEPLAINIPYTHONc                   C   s   t  rt  d S N)
matplotlibis_interactivedraw_allrQ   rQ   rQ   rR   _draw_all_if_interactiveu   s    r[   c                  C   s|   t tju rdS tjd} | s(tja dS |  }|s>tja dS |j	dt
 tja ddlm} |t }|rx|| dS )a\  
    Connect to the display hook of the current shell.

    The display hook gets called when the read-evaluate-print-loop (REPL) of
    the shell has finished the execution of a command. We use this callback
    to be able to automatically update a figure in interactive mode.

    This works both with IPython and with vanilla python shells.
    NIPythonpost_executer   )backend2gui)_REPL_DISPLAYHOOKrS   rV   sysmodulesrK   rU   get_ipythoneventsregisterr[   ZIPython.core.pylabtoolsr^   r   Z
enable_gui)Zmod_ipythonipr^   Zipython_gui_namerQ   rQ   rR   install_repl_displayhookz   s     
rf   c                  C   s4   t tju r*ddlm}  |  }|jdt tja dS )z6Disconnect from the display hook of the current shell.r   )rb   r]   N)	r_   rS   rV   r\   rb   rc   
unregisterr[   rT   )rb   re   rQ   rQ   rR   uninstall_repl_displayhook   s
    
rh   c                  O   s   t j| i |S rW   )rX   set_loglevelargskwargsrQ   rQ   rR   ri      s    ri   Tc                 C   s   | d u rt  } | j||dS )N)include_self)gcffindobj)omatchrm   rQ   rQ   rR   ro      s    ro   c                 C   s&   t | jdstjddd d S | jjS )Nrequired_interactive_framework3.6zMSupport for FigureCanvases without a required_interactive_framework attribute)name)hasattrFigureCanvasr   warn_deprecatedrr   backend_modrQ   rQ   rR   #_get_required_interactive_framework   s    rz   c                   C   s   t du rtttd t S )z
    Ensure that a backend is selected and return it.

    This is currently private, but may be made public in the future.
    Nbackend)_backend_modswitch_backenddict__getitem__r   rQ   rQ   rQ   rR   _get_backend_mod   s    r   c           
   	      s  ddl td | tju rt }dddddd	d
d}||d}|durR|g}ng }|g d7 }|D ]6}zt| W n ty   Y qfY qf0 |t	d<  dS qftd
 d
t	d< dS t
t|   jt }|dur
t }|r
|r
||kr
td| ||t dd}G  fdddjj |du rtfddtdfdd
}fdd} _| _| _td|  j |  td< td<  adD ]}	tt |	t |	 _ q| j!_"t#  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allqtagggtk3agggtk4aggwxaggtkaggmacosxagg)qtgtk3gtk4wxtkr   headless)r   r   r   r   r   r   r{   zdCannot load backend {!r} which requires the {!r} interactive framework, as {!r} is currently runningnew_figure_managerc                       s   e Zd Ze e  dS )z#switch_backend.<locals>.backend_modN)__name__
__module____qualname__localsupdatevarsrQ   rx   rQ   rR   ry      s   ry   c                    s     || S rW   )new_manager)numfigure)canvas_classrQ   rR   new_figure_manager_given_figure(  s    z7switch_backend.<locals>.new_figure_manager_given_figure)FigureClassc                   s   ||i |} | |S rW   rQ   )r   r   rk   rl   fig)r   rQ   rR   r   +  s    z*switch_backend.<locals>.new_figure_managerc                     s$      r tj } | r | j  d S rW   )rY   r	   Gcf
get_activecanvas	draw_idlemanager)rX   rQ   rR   draw_if_interactive/  s    
z+switch_backend.<locals>.draw_if_interactivezLoaded backend %s version %s.)r   r   show)$Zmatplotlib.backendscloser   _auto_backend_sentinelr   "_get_running_interactive_frameworkrK   r}   ImportErrorr   	importlibimport_module_backend_module_namerv   rz   formatrH   Zbackend_basesZ_Backendr   r   r   r   _logdebugZbackend_versionr   r   r|   inspect	signatureglobals__signature__backendsr{   rf   )
Z
newbackendZcurrent_frameworkmappingZ
best_guess
candidates	candidateZrequired_frameworkr   r   	func_namerQ   )ry   r   rX   r   rR   r}      s~    


	
r}   c                   C   s*   t t r&t t jkr&td d S )NzFStarting a Matplotlib GUI outside of the main thread will likely fail.)rz   r   	threadingget_native_idmain_thread	native_idr   warn_externalrQ   rQ   rQ   rR   _warn_if_gui_out_of_main_threadL  s    
r   c                  O   s   t   t j| i |S )z%Create a new figure manager instance.)r   r   r   rj   rQ   rQ   rR   r   X  s    r   c                  O   s   t  j| i |S )z
    Redraw the current figure if in interactive mode.

    .. warning::

        End users will typically not have to call this function because the
        the interactive mode takes care of this.
    )r   r   rj   rQ   rQ   rR   r   _  s    	r   c                  O   s   t   t j| i |S )a  
    Display all open figures.

    Parameters
    ----------
    block : bool, optional
        Whether to wait for all figures to be closed before returning.

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

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

        Defaults to True in non-interactive mode and to False in interactive
        mode (see `.pyplot.isinteractive`).

    See Also
    --------
    ion : Enable interactive mode, which shows / updates the figure after
          every plotting command, so that calling ``show()`` is not necessary.
    ioff : Disable interactive mode.
    savefig : Save the figure to an image file instead of showing it on screen.

    Notes
    -----
    **Saving figures to file and showing a window at the same time**

    If you want an image file as well as a user interface window, use
    `.pyplot.savefig` before `.pyplot.show`. At the end of (a blocking)
    ``show()`` the figure is closed and thus unregistered from pyplot. Calling
    `.pyplot.savefig` afterwards would save a new and thus empty figure. This
    limitation of command order does not apply if the show is non-blocking or
    if you keep a reference to the figure and use `.Figure.savefig`.

    **Auto-show in jupyter notebooks**

    The jupyter backends (activated via ``%matplotlib inline``,
    ``%matplotlib notebook``, or ``%matplotlib widget``), call ``show()`` at
    the end of every cell by default. Thus, you usually don't have to call it
    explicitly there.
    )r   r   r   rj   rQ   rQ   rR   r   l  s    ,r   c                   C   s   t  S )a%  
    Return whether plots are updated after every plotting command.

    The interactive mode is mainly useful if you build plots from the command
    line and want to see the effect of each command while you are building the
    figure.

    In interactive mode:

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

    In non-interactive mode:

    - 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 all figures (and maybe block).
    pause : Show all figures, and block for a time.
    )rX   rY   rQ   rQ   rQ   rR   isinteractive  s    r   c                  C   s.   t  } | t rtnt td t  | S )a  
    Disable interactive mode.

    See `.pyplot.isinteractive` for more details.

    See Also
    --------
    ion : Enable interactive mode.
    isinteractive : Whether interactive mode is enabled.
    show : Show all figures (and maybe block).
    pause : Show all figures, and block for a time.

    Notes
    -----
    For a temporary change, this can be used as a context manager::

        # if interactive mode is on
        # then figures will be shown on creation
        plt.ion()
        # This figure will be shown immediately
        fig = plt.figure()

        with plt.ioff():
            # interactive mode will be off
            # figures will not automatically be shown
            fig2 = plt.figure()
            # ...

    To enable optional usage as a context manager, this function returns a
    `~contextlib.ExitStack` object, which is not intended to be stored or
    accessed by the user.
    F)r   callbackr   ionioffrX   r
   rh   stackrQ   rQ   rR   r     s
    !
r   c                  C   s.   t  } | t rtnt td t  | S )a  
    Enable interactive mode.

    See `.pyplot.isinteractive` for more details.

    See Also
    --------
    ioff : Disable interactive mode.
    isinteractive : Whether interactive mode is enabled.
    show : Show all figures (and maybe block).
    pause : Show all figures, and block for a time.

    Notes
    -----
    For a temporary change, this can be used as a context manager::

        # if interactive mode is off
        # then figures will not be shown on creation
        plt.ioff()
        # This figure will not be shown immediately
        fig = plt.figure()

        with plt.ion():
            # interactive mode will be on
            # figures will automatically be shown
            fig2 = plt.figure()
            # ...

    To enable optional usage as a context manager, this function returns a
    `~contextlib.ExitStack` object, which is not intended to be stored or
    accessed by the user.
    T)r   r   r   r   r   rX   r
   rf   r   rQ   rQ   rR   r     s
    !
r   c                 C   sL   t j }|dur>|j}|jjr(|  tdd ||  n
t	
|  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 : Proper animations
    show : Show all figures and optional block until all figures are closed.
    NF)block)r	   r   r   r   r   staler   r   Zstart_event_looptimesleep)intervalr   r   rQ   rQ   rR   pause
  s    

r   c                 K   s   t j| fi | d S rW   )rX   rc)grouprl   rQ   rQ   rR   r   &  s    r   c                 C   s   t | |S rW   )rX   
rc_context)r   fnamerQ   rQ   rR   r   +  s    r   c                   C   s   t   t  rt  d S rW   )rX   
rcdefaultsrY   rZ   rQ   rQ   rQ   rR   r   0  s    r   c                 O   s   t jj| g|R i |S rW   )rX   artistgetpobjrk   rl   rQ   rQ   rR   r   :  s    r   c                 O   s   t jj| g|R i |S rW   )rX   r   rK   r   rQ   rQ   rR   rK   ?  s    rK   c                 O   s   t jj| g|R i |S rW   )rX   r   setpr   rQ   rQ   rR   r   D  s    r   d      c                 C   sz   t d rtdt }|tjt t   ddlm} t g dd| ||f|j	ddd	gd
ddddddddddd |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()
    ztext.usetexz3xkcd mode is not compatible with text.usetex = Truer   )patheffects)xkcdzxkcd Scriptz
Humor Sansz
Comic NeuezComic Sans MSg      ,@   w)	linewidth
foregroundg      ?g       @whiteg        F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   RuntimeErrorr   r   r~   r   rG   rX   r   Z
withStroke)scalelengthZ
randomnessr   r   rQ   rQ   rR   r   I  s4    $r   rs   	facecolorFc              	   K   sr  t | tr4| jjdu rtdtj| jj | jS t	 }	|	rJt
|	d nd}
d}| du r`|
} nPt | tr| }t }||vr|dkrtd |
} q||}|	| } nt| } tj| }|du rXtd }t|	|  krdkrn ntd| d	t t| f||||||d
|}|jj}|r4|| tj| t  ttju rXt|_|rj|jj  |jjS )a
  
    Create a new figure, or activate an existing figure.

    Parameters
    ----------
    num : int or str or `.Figure` or `.SubFigure`, 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.  If num is a ``SubFigure``, its
        parent ``Figure`` is activated.

    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`
        If set, an instance of this subclass will be created, rather than a
        plain `.Figure`.

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

    layout : {'constrained', 'tight', `.LayoutEngine`, None}, default: None
        The layout mechanism for positioning of plot elements to avoid
        overlapping Axes decorations (labels, ticks, etc). Note that layout
        managers can measurably slow down figure display. Defaults to *None*
        (but see the documentation of the `.Figure` constructor regarding the
        interaction with rcParams).

    **kwargs
        Additional keyword arguments are passed to the `.Figure` constructor.

    Returns
    -------
    `~matplotlib.figure.Figure`

    Notes
    -----
    Newly created figures are passed to the `~.FigureCanvasBase.new_manager`
    method or the `new_figure_manager` function provided by the current
    backend, which install a canvas and a manager on the figure.

    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*The passed figure is not managed by pyplotr.    r   z)close('all') closes all existing figures.zfigure.max_open_warningz
More than a   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`). Consider using `matplotlib.pyplot.close()`.)figsizedpir   	edgecolorframeonr   )
isinstancer   r   r   
ValueErrorr	   r   Z
set_activer   get_fignumsmaxstrget_figlabelsr   r   indexintZget_fig_managerr   lenRuntimeWarningr   	set_labelZ_set_new_active_managerr   r_   rS   rU   _auto_draw_if_interactiveZstale_callbackclear)r   r   r   r   r   r   r   r   rl   ZallnumsZnext_numZ	fig_label
all_labelsZinumr   Zmax_open_warningr   rQ   rQ   rR   r     s^    P






	
r   c                 C   sV   |rRt  rR| j sR| jjsR| j  | j  W d   n1 sH0    Y  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)rX   rY   r   Z	is_savingZ_is_idle_drawingZ_idle_draw_cntxr   )r   valrQ   rQ   rR   r     s    
r   c                  C   s$   t j } | dur| jjS t S dS )a  
    Get the current figure.

    If there is currently no figure on the pyplot figure stack, a new one is
    created using `~.pyplot.figure()`.  (To test whether there is currently a
    figure on the pyplot figure stack, check whether `~.pyplot.get_fignums()`
    is empty.)
    N)r	   r   r   r   r   r   rQ   rQ   rR   rn   1  s    	
rn   c                 C   s   t j| p| t v S )z3Return whether the figure with the given id exists.)r	   r   Z
has_fignumr   r   rQ   rQ   rR   fignum_existsA  s    r   c                   C   s   t tjjS )z)Return a list of existing figure numbers.)sortedr	   r   ZfigsrQ   rQ   rQ   rR   r   F  s    r   c                  C   s(   t j } | jdd d dd | D S )z(Return a list of existing figure labels.c                 S   s   | j S rW   r   )mrQ   rQ   rR   <lambda>N      zget_figlabels.<locals>.<lambda>)keyc                 S   s   g | ]}|j j qS rQ   )r   r   	get_label).0r   rQ   rQ   rR   
<listcomp>O  r   z!get_figlabels.<locals>.<listcomp>)r	   r   Zget_all_fig_managerssort)managersrQ   rQ   rR   r   K  s    
r   c                   C   s
   t  jjS )ah  
    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 no current figure exists, a new one is created, and its figure
    manager is returned.

    Returns
    -------
    `.FigureManagerBase` or backend-dependent subclass thereof
    )rn   r   r   rQ   rQ   rQ   rR   get_current_fig_managerR  s    r  c                 C   s   t  j| |S rW   )rn   r   mpl_connect)srN   rQ   rQ   rR   connectc  s    r  c                 C   s   t  j| S rW   )rn   r   mpl_disconnect)cidrQ   rQ   rR   
disconnecth  s    r
  c                 C   s   | du r,t j }|du rdS t j| n| dkr@t j  nt| trXt j|  nxt| drrt j| j n^t| trt	 }| |v rt
 ||  }t j| n(t| trt j|  ntdt|  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   zDclose() argument must be a Figure, an int, a string, or None, not %s)r	   r   r   destroyZdestroy_allr   r   ru   r   r   r   r   r   Zdestroy_fig	TypeErrortype)r   r   r   r   rQ   rQ   rR   r   m  s*    




r   c                   C   s   t    dS )zClear the current figure.N)rn   r   rQ   rQ   rQ   rR   clf  s    r  c                   C   s   t  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)rn   r   r   rQ   rQ   rQ   rR   draw  s    r  c                  O   s$   t  }|j| i |}|j  |S rW   )rn   savefigr   r   )rk   rl   r   resrQ   rQ   rR   r    s    
r  c                  O   s   t  j| i |S rW   )rn   legendrj   rQ   rQ   rR   	figlegend  s    r  zlegend(z
figlegend(c                 K   s\   t  }|dd}| du rF|du r2|jf i |S |j|fi |S n|j| fi |S dS )a6  
    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(**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:kwdoc)s

    Notes
    -----
    If the figure already has an 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 a grey background
        plt.axes((left, bottom, width, height), facecolor='grey')
    positionN)rn   popadd_subplotadd_axes)argrl   r   posrQ   rQ   rR   axes  s    Wr  c                 C   s   | du rt  } |   dS )zS
    Remove an `~.axes.Axes` (defaulting to the current axes) from its figure.
    N)gcaremoveaxrQ   rQ   rR   delaxes   s    r  c                 C   s   t | j  | j |  dS )zT
    Set the current Axes to *ax* and the current Figure to the parent of *ax*.
    N)r   scar  rQ   rQ   rR   r   )  s    
r   c                   C   s
   t   S )zClear the current axes.)r  clarQ   rQ   rQ   rR   r!  1  s    r!  c            	         sb  t  }|d|}|d|}||ur\|r\||urP|dkrPtd| d|dd |d< }t| dkrld} t| dkrt| d	 trtd
 d|v sd|v rt	dt
 }t|| }|jD ]F t dr  |kr|i kr qq j|j| i |kr qq|j| i | |   fdd|jD }|rJtjddd |D ]}t| qN S )a;  
    Add an Axes to the current figure or retrieve an existing Axes.

    This is a wrapper of `.Figure.add_subplot` which provides additional
    behavior when working with the implicit API (see 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:kwdoc)s

    Notes
    -----
    Creating a new Axes will delete any preexisting Axes 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 no *kwargs* are passed and there exists an Axes in the location
    specified by *args* then that Axes will be returned rather than a new
    Axes being created.

    If *kwargs* are passed and there exists an Axes in the location
    specified by *args*, the projection type is the same, and the
    *kwargs* match with the existing Axes, then the existing Axes is
    returned.  Otherwise a new Axes is created with the specified
    parameters.  We save a reference to the *kwargs* which we use
    for this comparison.  If any of the values in *kwargs* are
    mutable we will not detect the case where they are mutated.
    In these cases we suggest using `.Figure.add_subplot` and the
    explicit Axes API rather than the implicit pyplot API.

    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)

        # make the first axes "current" again
        plt.subplot(221)

    
projectionpolarzpolar=z, yet projection=z1. Only one of these arguments should be supplied.r   )r.   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()?get_subplotspecc                    s&   g | ]}| kr j |j r|qS rQ   bboxfully_overlapsr   otherr  rQ   rR   r    s   zsubplot.<locals>.<listcomp>rs   Auto-removal of overlapping axes is deprecated since %(since)s and will be removed %(removal)s; explicitly call ax.remove() as needed.message)objectrK   r  r   r   r   boolr   r   r  rn   r   Z_from_subplot_argsr  ru   r&  Z_projection_initZ _process_projection_requirementsr  r   rw   r  )	rk   rl   unsetr"  r#  r   r   axes_to_delete	ax_to_delrQ   r  rR   subplot9  sL     


r4  )sharexshareysqueezewidth_ratiosheight_ratios
subplot_kwgridspec_kwc                K   s2   t f i |	}
|
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`.

        When subplots have a shared axis that has units, calling
        `~matplotlib.axis.Axis.set_units` will update each axis with the
        new units.

    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.

    width_ratios : array-like of length *ncols*, optional
        Defines the relative widths of the columns. Each column gets a
        relative width of ``width_ratios[i] / sum(width_ratios)``.
        If not given, all columns will have the same width.  Equivalent
        to ``gridspec_kw={'width_ratios': [...]}``.

    height_ratios : array-like of length *nrows*, optional
        Defines the relative heights of the rows. Each row gets a
        relative height of ``height_ratios[i] / sum(height_ratios)``.
        If not given, all rows will have the same height. Convenience
        for ``gridspec_kw={'height_ratios': [...]}``.

    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`

    ax : `~.axes.Axes` or array of Axes
        *ax* can be either a single `~.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.subplots(1, 2)
            fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(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(projection="polar"))
        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%  r5  r6  r7  r:  r;  r9  r8  )r   subplots)r$  r%  r5  r6  r7  r8  r9  r:  r;  fig_kwr   axsrQ   rQ   rR   r<    s     r<  .)r5  r6  r8  r9  empty_sentinelr:  r;  c             
   K   s0   t f i |}	|	j| |||||||d}
|	|
fS )a  
    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.

    See :doc:`/tutorials/provisional/mosaic`
    for an example and full API documentation

    Parameters
    ----------
    mosaic : 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.

    sharex, sharey : bool, default: False
        If True, the x-axis (*sharex*) or y-axis (*sharey*) will be shared
        among all subplots.  In that case, tick label visibility and axis units
        behave as for `subplots`.  If False, each subplot's x- or y-axis will
        be independent.

    width_ratios : array-like of length *ncols*, optional
        Defines the relative widths of the columns. Each column gets a
        relative width of ``width_ratios[i] / sum(width_ratios)``.
        If not given, all columns will have the same width.  Convenience
        for ``gridspec_kw={'width_ratios': [...]}``.

    height_ratios : array-like of length *nrows*, optional
        Defines the relative heights of the rows. Each row gets a
        relative height of ``height_ratios[i] / sum(height_ratios)``.
        If not given, all rows will have the same height. Convenience
        for ``gridspec_kw={'height_ratios': [...]}``.

    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.

    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.

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

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

    dict[label, Axes]
       A dictionary mapping the labels to the Axes objects.  The order of
       the axes is left-to-right and top-to-bottom of their position in the
       total layout.

    )r5  r6  r9  r8  r:  r;  r@  )r   subplot_mosaic)Zmosaicr5  r6  r8  r9  r@  r:  r;  r=  r   Zax_dictrQ   rQ   rR   rA    s    ^rA  c                    s   |du rt  }| \}}t|||}|j|||d}	|j|	fi |  fdd|jD }
|
rltjddd |
D ]}t| qp 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 downwards.
    colspan : int, default: 1
        Number of columns for the axis to span to the right.
    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colspanc                    s&   g | ]}| kr j |j r|qS rQ   r'  r*  r  rQ   rR   r  8  s   z subplot2grid.<locals>.<listcomp>rs   r,  r-  )	rn   r   Z_check_gridspec_existsZnew_subplotspecr  r  r   rw   r  )shapelocrB  rC  r   rl   rowscolsgsZsubplotspecr2  r3  rQ   r  rR   subplot2grid  s    )
rI  c                 C   s   | du rt  } |  }|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  ax1rQ   rQ   rR   rJ  E  s    
rJ  c                 C   s   | du rt  } |  }|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  twinyrK  rQ   rQ   rR   rM  U  s    
rM  c                 C   sJ   | du rt  } | jjj}t|dr*| S t|dr>|dS tddS )zr
    Launch a subplot tool window for a figure.

    Returns
    -------
    `matplotlib.widgets.SubplotTool`
    Nconfigure_subplotstrigger_toolr<  zHsubplot_tool can only be launched for figures with an associated toolbar)rn   r   r   toolbarru   rN  rO  r   )Z	targetfigtbrQ   rQ   rR   subplot_toole  s    



rR  c                 C   s&   t  }| du r|  } ||  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  rQ   rQ   rR   boxy  s    
rT  c                  O   s*   t  }| s|s| S |j| i |}|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_xlimset_xlimrk   rl   r  retrQ   rQ   rR   xlim  s
    rX  c                  O   s*   t  }| s|s| S |j| i |}|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  get_ylimset_ylimrV  rQ   rQ   rR   ylim  s
    r[  minorc                K   s   t  }| du r,|j|d}|dur:tdn|j| |d}|du rd|j|d}|D ]}|| qRn|j|fd|i|}||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.
    minor : bool, default: False
        If ``False``, get/set the major ticks/labels; if ``True``, the minor
        ticks/labels.
    **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.
    Nr\  zAxticks(): Parameter 'labels' can't be set without setting 'ticks'r]  )r  Z
get_xticksr  Z
set_xticksZget_xticklabels_internal_updateZset_xticklabelstickslabelsr]  rl   r  locslrQ   rQ   rR   xticks  s    +
rd  c                K   s   t  }| du r,|j|d}|dur:tdn|j| |d}|du rd|j|d}|D ]}|| qRn|j|fd|i|}||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.
    minor : bool, default: False
        If ``False``, get/set the major ticks/labels; if ``True``, the minor
        ticks/labels.
    **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.
    Nr\  zAyticks(): Parameter 'labels' can't be set without setting 'ticks'r]  )r  Z
get_yticksr  Z
set_yticksZget_yticklabelsr^  Zset_yticklabelsr_  rQ   rQ   rR   yticks  s    +
re  c                 K   sr   t  }t|tstdtdd | |||fD rL|sL|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 u V  qd S rW   rQ   )r   prQ   rQ   rR   	<genexpr>  r   zrgrids.<locals>.<genexpr>)ra  anglefmt)	r  r   r   r   r   yaxisZget_gridlinesget_ticklabelsZ
set_rgrids)Zradiira  rh  ri  rl   r  linesrQ   rQ   rR   rgridsX  s    ;


rm  c                 K   sn   t  }t|tstdtdd | ||fD rJ|sJ|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 u V  qd S rW   rQ   )r   paramrQ   rQ   rR   rg    r   zthetagrids.<locals>.<genexpr>)ra  ri  )	r  r   r   r   r   xaxisZget_ticklinesrk  Zset_thetagrids)anglesra  ri  rl   r  rl  rQ   rQ   rR   
thetagrids  s    8


rq  >   r  ginputr
  waitforbuttonpressr  r   c                      s:   dddht t ttt fddt  D S )z<
    Get a sorted list of all of the plotting commands.
    	colormapscolorsget_plot_commandsc                 3   s@   | ]8\}}| d s| vrt|rt|u r|V  qdS )_N)
startswithr   
isfunction	getmodule)r   rt   r   excludeZthis_modulerQ   rR   rg    s
   
z$get_plot_commands.<locals>.<genexpr>)_NON_PLOT_COMMANDSrt  r   rz  rv  r   r   itemsrQ   rQ   r{  rR   rv    s    
rv  c                 K   s<   | d u rt  } | d u rtd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   rn   colorbar)Zmappabler  r  rl   rW  rQ   rQ   rR   r    s    r  c                 C   s&   t  }|du rtd|| | 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)r  r   set_clim)vminvmaximrQ   rQ   rR   clim	  s    r  c                 C   s   t j| |dS )Nrt   lut)r   	_get_cmapr  rQ   rQ   rR   get_cmap   s    r  c                 C   s2   t | } td| jd t }|dur.||  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   rt   r  set_cmap)r  r  rQ   rQ   rR   r  %  s
    r  c                 C   s   t j| |S rW   )rX   r  imread)r   r   rQ   rQ   rR   r  =  s    r  c                 K   s   t jj| |fi |S rW   )rX   r  imsave)r   arrrl   rQ   rQ   rR   r  B  s    r  c                 K   sV   t | } |dkrt }nt|t| d}|g d}|j| fi |}t| |S )aa  
    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 : 2D array-like
        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=
??r  )np
asanyarrayr  r   r   r  matshowsci)Afignumrl   r  r   r  rQ   rQ   rR   r  G  s    '
r  c                  O   s@   t   r&t }t|ts0td n
tdd}|j| i |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 Axes that does not have a polar projection.r#  )r"  )	rn   Zget_axesr  r   r   r   r   r  plot)rk   rl   r  rQ   rQ   rR   r#  {  s    


r#  backend_fallbackWebAggnbAggr{   c
                 K   s(   t  j| f|||||||||	d	|
S )N)	xoyoalphanormr  r  r  originresize)rn   figimage)Xr  r  r  r  r  r  r  r  r  rl   rQ   rQ   rR   r    s    r  c                 K   s   t  j| ||fd|i|S Nfontdict)rn   textxyr  r  rl   rQ   rQ   rR   figtext  s    r  c                   C   s
   t   S rW   )rn   r  rQ   rQ   rQ   rR   r    s    r  c                   C   s
   t   S rW   )rn   _gcirQ   rQ   rQ   rR   r    s    r     c                 C   s   t  j| |||||dS )NntimeoutZshow_clicksZ	mouse_addZ	mouse_popZ
mouse_stop)rn   rr  r  rQ   rQ   rR   rr    s
    rr  c                 C   s   t  j| |||||dS )NleftbottomrighttopZwspaceZhspace)rn   subplots_adjustr  rQ   rQ   rR   r    s    
r  c                 K   s   t  j| fi |S rW   )rn   suptitle)trl   rQ   rQ   rR   r    s    r  gHzG?padZh_padZw_padrectc                 C   s   t  j| |||dS )Nr  )rn   tight_layoutr  rQ   rQ   rR   r    s    r  rC   c                 C   s   t  j| dS )Nr  )rn   rs  r  rQ   rQ   rR   rs    s    rs  )datac                K   s(   t  j| fi |d urd|ini |S Nr  )r  acorr)r  r  rl   rQ   rQ   rR   r    s    r  c                K   s4   t  j| f|||||d|d ur(d|ini |S N)FsFcwindowpad_tosidesr  )r  angle_spectrumr  r  r  r  r  r  r  rl   rQ   rQ   rR   r    s    
r  r  c                 K   s"   t  j| |f|||||d|S )N)xytextxycoords
textcoords
arrowpropsannotation_clip)r  annotate)r  xyr  r  r  r  r  rl   rQ   rQ   rR   r    s    r  c                 K   s   t  j| |||fi |S rW   )r  arrow)r  r  dxdyrl   rQ   rQ   rR   r    s    r  bothc                 C   s   t  j| ||dS )Nenableaxistight)r  	autoscaler  rQ   rQ   rR   r  	  s    r  c                 K   s   t  jf | ||d|S )N)r  xminxmax)r  axhline)r  r  r  rl   rQ   rQ   rR   r  	  s    r  c                 K   s   t  j| |f||d|S )N)r  r  )r  axhspan)yminymaxr  r  rl   rQ   rQ   rR   r  	  s    r  )emitc                 O   s   t  j|d| i|S )Nr  )r  r  )r  rk   rl   rQ   rQ   rR   r  	  s    r  )slopec                K   s   t  j| f||d|S )N)xy2r  )r  axline)Zxy1r  r  rl   rQ   rQ   rR   r  	  s    r  c                 K   s   t  jf | ||d|S )N)r  r  r  )r  axvline)r  r  r  rl   rQ   rQ   rR   r  #	  s    r  c                 K   s   t  j| |f||d|S )N)r  r  )r  axvspan)r  r  r  r  rl   rQ   rQ   rR   r  )	  s    r  皙?center)alignr  c                K   s2   t  j| |f|||d|d ur&d|ini |S )N)widthr  r  r  )r  bar)r  heightr  r  r  r  rl   rQ   rQ   rR   r  /	  s    r  c                 O   s&   t  j|i | d urd| ini |S r  )r  barbsr  rk   rl   rQ   rQ   rR   r  9	  s    r  c                K   s2   t  j| |f|||d|d ur&d|ini |S )N)r  r  r  r  )r  barh)r  r  r  r  r  r  rl   rQ   rQ   rR   r  A	  s    r  z%gedge)ri  
label_typepaddingc                K   s   t  j| f||||d|S )N)ra  ri  r  r  )r  	bar_label)	containerra  ri  r  r  rl   rQ   rQ   rR   r  K	  s    r  c                C   sZ   t  j| f|||||||||	|
||||||||||||||||d|d urRd|ini S )N)notchsymvertwhis	positionswidthspatch_artist	bootstrapusermediansconf_intervalsmeanline	showmeansshowcapsshowbox
showfliersboxpropsra  
flierpropsmedianprops	meanpropscappropswhiskerpropsmanage_ticks	autorangezorder	capwidthsr  )r  boxplot)r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r  ra  r  r  r  r  r  r  r  r	  r
  r  rQ   rQ   rR   r  U	  s     
r  c                K   s*   t  j| |fi |d urd|ini |S r  )r  broken_barh)ZxrangesZyranger  rl   rQ   rQ   rR   r  n	  s    r  c                 K   s   t  j| fd|i|S )Nlevels)r  clabel)CSr  rl   rQ   rQ   rR   r  v	  s    r     defaultc                K   s>   t  j| |f||||||||	|
d	|d u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  rl   rQ   rQ   rR   r  |	  s    
r  c                 O   s<   t  j|i | d urd| ini |}|jd ur8t| |S r  )r  contour_Ar  r  rk   rl   __retrQ   rQ   rR   r  	  s    r  c                 O   s<   t  j|i | d urd| ini |}|jd ur8t| |S r  )r  contourfr  r  r  rQ   rQ   rR   r  	  s    r  c                K   s@   t  j| |f||||||||	|
|d
|d u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  rl   rQ   rQ   rR   r  	  s    
r  r   c                K   sF   t  j| |f||||||||	|
||||d|d ur:d|ini |S )N)yerrxerrri  ecolor
elinewidthcapsize	barsabovelolimsuplimsxlolimsxuplims
erroreverycapthickr  )r  errorbar)r  r  r  r   ri  r!  r"  r#  r$  r%  r&  r'  r(  r)  r*  r  rl   rQ   rQ   rR   r+  	  s    r+  
horizontalsolidc          	   	   K   s6   t  j| f||||||d|d ur*d|ini |S )N)orientationlineoffsetslinelengths
linewidthsru  
linestylesr  )r  	eventplot)	r  r.  r/  r0  r1  ru  r2  r  rl   rQ   rQ   rR   r3  	  s    r3  c                 O   s&   t  j|i | d urd| ini |S r  )r  fillr  rQ   rQ   rR   r4  	  s    r4  c                K   s4   t  j| |f||||d|d ur(d|ini |S )N)y2whereinterpolatestepr  )r  fill_between)r  y1r5  r6  r7  r8  r  rl   rQ   rQ   rR   r9  	  s    r9  c                K   s4   t  j| |f||||d|d ur(d|ini |S )N)x2r6  r8  r7  r  )r  fill_betweenx)r  x1r;  r6  r8  r7  r  rl   rQ   rQ   rR   r<  	  s    r<  majorc                 K   s   t  jf | ||d|S )N)visiblewhichr  )r  grid)r?  r@  r  rl   rQ   rQ   rR   rA  	  s    rA  linearZfacec                K   sX   t  j| |f||||||||	|
|||||||d|d ur@d|ini |}t| |S )N)Cgridsizebinsxscaleyscaleextentr  r  r  r  r  r1  
edgecolorsreduce_C_functionmincnt	marginalsr  )r  hexbinr  )r  r  rC  rD  rE  rF  rG  rH  r  r  r  r  r  r1  rI  rJ  rK  rL  r  rl   r  rQ   rQ   rR   rM  	  s    
rM  midverticalc                K   sF   t  j| f|||||||||	|
||||d|d ur:d|ini |S )N)rE  rangedensityweights
cumulativer  histtyper  r.  rwidthlogcolorlabelstackedr  )r  hist)r  rE  rP  rQ  rR  rS  r  rT  r  r.  rU  rV  rW  rX  rY  r  rl   rQ   rQ   rR   rZ  	  s    rZ  )r.  baseliner4  r  c                K   s2   t  j| f||||d|d ur&d|ini |S )N)edgesr.  r[  r4  r  )r  stairs)valuesr\  r.  r[  r4  r  rl   rQ   rQ   rR   r]  

  s    r]  
   c             	   K   sH   t  j| |f||||||d|d ur,d|ini |	}
t|
d  |
S )N)rE  rP  rQ  rR  cmincmaxr  rC   )r  hist2dr  )r  r  rE  rP  rQ  rR  r`  ra  r  rl   r  rQ   rQ   rR   rb  
  s    rb  c                K   s4   t  j| ||f|||d|d ur(d|ini |S N)ru  r2  rX  r  )r  hlines)r  r  r  ru  r2  rX  r  rl   rQ   rQ   rR   rd  "
  s    rd        @)interpolation_stage
filternorm	filterradresampleurlr  c
                K   sR   t  j| f|||||||||	|
||||d|d ur:d|ini |}t| |S )N)r  r  aspectinterpolationr  r  r  r  rH  rf  rg  rh  ri  rj  r  )r  imshowr  )r  r  r  rk  rl  r  r  r  r  rH  rf  rg  rh  ri  rj  r  rl   r  rQ   rQ   rR   rm  -
  s     rm  c                  O   s   t  j| i |S rW   )r  r  rj   rQ   rQ   rR   r  @
  s    r  c                 K   s   t  jf | |d|S )N)r  r  )r  locator_params)r  r  rl   rQ   rQ   rR   rn  F
  s    rn  c                  O   s   t  j| i |S rW   )r  loglogrj   rQ   rQ   rR   ro  L
  s    ro  c          	   	   K   s6   t  j| f||||||d|d u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  rl   rQ   rQ   rR   rp  R
  s    
rp  r  r  r  c                 G   s   t  j|| ||dS )Nrq  )r  margins)r  r  r  rr  rQ   rQ   rR   rr  ]
  s    rr  c                   C   s
   t   S rW   )r  minorticks_offrQ   rQ   rQ   rR   rs  c
  s    rs  c                   C   s
   t   S rW   )r  minorticks_onrQ   rQ   rQ   rR   rt  i
  s    rt  )shadingr  r  r  r  r  r  c           
   	   O   s@   t  j|| |||||d|d ur(d|ini |}	t|	 |	S )N)ru  r  r  r  r  r  r  )r  pcolorr  )
ru  r  r  r  r  r  r  rk   rl   r  rQ   rQ   rR   rv  o
  s    
rv  )r  r  r  r  r  ru  antialiasedr  c              
   O   sB   t  j|| ||||||d|d ur*d|ini |	}
t|
 |
S )N)r  r  r  r  r  ru  rw  r  )r  
pcolormeshr  )r  r  r  r  r  ru  rw  r  rk   rl   r  rQ   rQ   rR   rx  |
  s    
rx  c                K   s4   t  j| f|||||d|d ur(d|ini |S r  )r  phase_spectrumr  rQ   rQ   rR   ry  
  s    
ry  333333?皙?r   r   )	normalizer  c                C   sF   t  j| f|||||||||	|
||||||d|d ur>d|ini S )N)explodera  ru  autopctpctdistanceshadowlabeldistance
startangleradiuscounterclock
wedgeprops	textpropsr  framerotatelabelsr}  r  )r  pie)r  r~  ra  ru  r  r  r  r  r  r  r  r  r  r  r  r  r}  r  rQ   rQ   rR   r  
  s    r  )scalexscaleyr  c                 O   s,   t  j|| |d|d ur d|ini |S )N)r  r  r  )r  r  )r  r  r  rk   rl   rQ   rQ   rR   r  
  s    r  rp   c                K   s4   t  j| |f||||d|d ur(d|ini |S )N)ri  tzxdateydater  )r  	plot_date)r  r  ri  r  r  r  r  rl   rQ   rQ   rR   r  
  s    r  c                K   s>   t  j| f|||||||||	|
d
|d ur2d|ini |S r  )r  psd)r  r  r  r  r  r  r  r  r  r  r  r  rl   rQ   rQ   rR   r  
  s    
r  c                 O   s2   t  j|i | d urd| ini |}t| |S r  )r  quiverr  r  rQ   rQ   rR   r  
  s    r  c                 K   s   t  j| ||||fi |S rW   )r  	quiverkey)Qr  YUrX  rl   rQ   rQ   rR   r  
  s    r  )rI  plotnonfiniter  c                K   sN   t  j| |f||||||||	|
||d|d ur6d|ini |}t| |S )N)r  cmarkerr  r  r  r  r  r1  rI  r  r  )r  scatterr  )r  r  r  r  r  r  r  r  r  r  r1  rI  r  r  rl   r  rQ   rQ   rR   r  
  s    
r  c                  O   s   t  j| i |S rW   )r  semilogxrj   rQ   rQ   rR   r  
  s    r  c                  O   s   t  j| i |S rW   )r  semilogyrj   rQ   rQ   rR   r  
  s    r  c                K   sX   t  j| f|||||||||	|
|||||d|d ur<d|ini |}t|d  |S )N)r  r  r  r  r  r  r  xextentr  r  r  moder   r  r  r  rC   )r  specgramr  )r  r  r  r  r  r  r  r  r  r  r  r  r  r   r  r  r  rl   r  rQ   rQ   rR   r  
  s    
r  equalupperc                 K   s8   t  j| f|||||d|}t|tjr4t| |S )N)	precisionr  
markersizerk  r  )r  spyr   r   ScalarMappabler  )Zr  r  r  rk  r  rl   r  rQ   rQ   rR   r    s    r  rQ   zero)ra  ru  r[  r  c                O   s6   t  j| g|R |||d|d ur*d|ini |S )N)ra  ru  r[  r  )r  	stackplot)r  ra  ru  r[  r  rk   rl   rQ   rQ   rR   r    s    r  )linefmt	markerfmtbasefmtr  rX  use_line_collectionr.  r  c           	   
   G   s2   t  j|| ||||||d|d ur*d|ini S )N)r  r  r  r  rX  r  r.  r  )r  stem)	r  r  r  r  rX  r  r.  r  rk   rQ   rQ   rR   r    s    r  pre)r6  r  c                O   s4   t  j| |g|R d|i|d ur(d|ini |S )Nr6  r  )r  r8  )r  r  r6  r  rk   rl   rQ   rQ   rR   r8  &  s    r8  -|>皙?c                C   sV   t  j| |||f||||||	|
|||||||d|d ur@d|ini }t|j |S )N)rQ  r   rW  r  r  	arrowsize
arrowstyle	minlength	transformr	  start_points	maxlengthintegration_directionbroken_streamlinesr  )r  
streamplotr  rl  )r  r  uvrQ  r   rW  r  r  r  r  r  r  r	  r  r  r  r  r  r  rQ   rQ   rR   r  .  s    	
r  r  r  r  closedc                 K   s.   t  jf | |||||||||	|
||d|S )N)cellTextcellColourscellLoc	colWidths	rowLabels
rowColoursrowLoc	colLabels
colColourscolLocrE  r(  r\  )r  table)r  r  r  r  r  r  r  r  r  r  rE  r(  r\  rl   rQ   rQ   rR   r  C  s    r  c                 K   s   t  j| ||fd|i|S r  )r  r  r  rQ   rQ   rR   r  S  s    r  c                 K   s   t  jf d| i|S )Nr  )r  tick_params)r  rl   rQ   rQ   rR   r  Y  s    r  r  r   	scilimits	useOffset	useLocaleuseMathTextc                 C   s   t  j| |||||dS )Nr  )r  ticklabel_formatr  rQ   rQ   rR   r  _  s
    r  c                  O   s(   t  j| i |}|jd ur$t| |S rW   )r  
tricontourr  r  rk   rl   r  rQ   rQ   rR   r  j  s    r  c                  O   s(   t  j| i |}|jd ur$t| |S rW   )r  tricontourfr  r  r  rQ   rQ   rR   r  r  s    r  g      ?flatr  r  r  r  r  ru  
facecolorsc           
   
   O   s.   t  j|| ||||||d|}	t|	 |	S )Nr  )r  	tripcolorr  )
r  r  r  r  r  ru  r  rk   rl   r  rQ   rQ   rR   r  z  s    
r  c                  O   s   t  j| i |S rW   )r  triplotrj   rQ   rQ   rR   r    s    r        ?c
                C   s8   t  j| f|||||||||	d	|
d ur0d|
ini S )N)	r  r  r  r  showextremashowmedians	quantilespoints	bw_methodr  )r  
violinplot)datasetr  r  r  r  r  r  r  r  r  r  rQ   rQ   rR   r    s    r  c                K   s4   t  j| ||f|||d|d ur(d|ini |S rc  )r  vlines)r  r  r  ru  r2  rX  r  rl   rQ   rQ   rR   r    s    r  c                K   s4   t  j| |f||||d|d ur(d|ini |S )N)normedr  	usevlinesmaxlagsr  )r  xcorr)r  r  r  r  r  r  r  rl   rQ   rQ   rR   r    s    r  c                 C   s   t  | S rW   )r  _sci)r  rQ   rQ   rR   r    s    r  )r  c                K   s   t  j| f||||d|S )N)r  rE  r  r  )r  	set_title)rX  r  rE  r  r  rl   rQ   rQ   rR   title  s    r  )rE  c                K   s   t  j| f|||d|S N)r  labelpadrE  )r  
set_xlabel)xlabelr  r  rE  rl   rQ   rQ   rR   r    s    r  c                K   s   t  j| f|||d|S r  )r  
set_ylabel)ylabelr  r  rE  rl   rQ   rQ   rR   r    s    r  c                 K   s   t  j| fi |S rW   )r  
set_xscalevaluerl   rQ   rQ   rR   rF    s    rF  c                 K   s   t  j| fi |S rW   )r  
set_yscaler  rQ   rQ   rR   rG    s    rG  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r  rQ   rQ   rQ   rR   r    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.
    boneNr  rQ   rQ   rQ   rR   r    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.
    coolNr  rQ   rQ   rQ   rR   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.
    copperNr  rQ   rQ   rQ   rR   r    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.
    flagNr  rQ   rQ   rQ   rR   r    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.
    grayNr  rQ   rQ   rQ   rR   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.
    hotNr  rQ   rQ   rQ   rR   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.
    hsvNr  rQ   rQ   rQ   rR   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.
    jetNr  rQ   rQ   rQ   rR   r  1  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.
    pinkNr  rQ   rQ   rQ   rR   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.
    prismNr  rQ   rQ   rQ   rR   r  G  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.
    springNr  rQ   rQ   rQ   rR   r  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.
    summerNr  rQ   rQ   rQ   rR   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.
    winterNr  rQ   rQ   rQ   rR   r  h  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.
    magmaNr  rQ   rQ   rQ   rR   r   s  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.
    infernoNr  rQ   rQ   rQ   rR   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.
    plasmaNr  rQ   rQ   rQ   rR   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.
    viridisNr  rQ   rQ   rQ   rR   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_spectralNr  rQ   rQ   rQ   rR   r    s    r  )N)NNT)NN)r.   r   r   )N)N)N)r.   r.   )r.   r.   N)N)N)N)N)NN)NN)NNNN)NNN)NNN)NN)NN)N)N)	r   r   NNNNNNF)N)NNNNNN)rC   )NNNNN)Nr  NNN)Tr  N)r   r   r.   )r   r.   )N)r   r   r.   )r   r.   )r  N)r  N)N)NNNNNNNNNNNNNNNNNNNNNNTFNN)N)
NNNNNNNNNN)NNr   NNNFFFFFr.   N)r,  r.   r.   NNr-  )r   NFN)r   NNF)Nr>  r  )NNFNFNr  rN  rO  NFNNF)N)r_  NFNNN)Nr-  r   )	NNNNNNNNN)r  N)NNNNNN)NNNNN)NNNNrz  Fr{  r   r.   TNNr|  FF)rp   NTF)
NNNNNNNNNN)	NNNNNNNNN)NNNNNNNNNNNNNNN)r   NNr  r  )r.   NNNNr.   r  r  NNNre  r  T)NNr  NNNr  NNr  r  Nr  )N)r  )	NTr  FTFNr   N)Nr-  r   )NNN)NN)NN(2  __doc__
contextlibr   enumr   rD   r   r   loggingnumbersr   rer`   r   r   r   rX   Zmatplotlib.colorbarZmatplotlib.imager   r   r   r	   r
   r   r   Zmatplotlib.backend_basesr   r   Zmatplotlib.figurer   r   r   Zmatplotlib.gridspecr   r   r   r   r   r   Zmatplotlib.rcsetupr   Z_interactive_bkmatplotlib.artistr   Zmatplotlib.axesr   r   Zmatplotlib.projectionsr   r   Zmatplotlib.scaler   r   matplotlib.cmr    rt  r!   matplotlib.colorsr"   color_sequencesnumpyr  r#   Zmatplotlib.linesr$   Zmatplotlib.textr%   r&   Zmatplotlib.patchesr'   r(   r)   r*   Zmatplotlib.widgetsr+   r,   r-   tickerr/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   	getLoggerr   r   rF   rS   rT   r_   r[   rf   rh   r   rZ   ri   ro   rz   r|   r   r}   r   r   r   r   r   r   r   r   r   r   r   r   r   rK   r   r   make_keyword_onlyr   r   rn   r   r   r   r  r  r  r  r
  r   r  r  r  r  r  replacededent_interpdr  r  r   r!  r4  r<  rA  rI  rJ  rM  rR  rT  rX  r[  rd  re  rm  rq  r}  rv  r  r  r  r  r  r  r  r  r  r#  _get_backend_or_nonesetr   r~   __setitem__r   r  r  r  r  r  r  rr  LEFTRIGHTZMIDDLEr  r  r  rs  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+  r3  r4  r9  r<  rA  rM  meanrZ  r]  rb  rd  rm  rn  ro  rp  rr  rs  rt  rv  rx  ry  r  r  r  r  r  r  r  r  r  r  r  r  r  rI   _deprecated_parameterr8  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  rF  r  rG  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r  r  r  r  rQ   rQ   rQ   rR   <module>   s  "T
%

	z0((

	





E
 

*


a	
 K
 h?%%??GD



4
 	

 	
	 

			       
		       		

   
 
  
	    	  	 

   
 
	



   
   








  









