B
    ]t\;                @   sz  d Z ddlZddlZddlZddlmZ ddlZddl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mZ ddlmZmZ ddlmZ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 m!Z!m"Z"m#Z# ddlm$Z$ ddl%m&Z' ddl(m)Z)m*Z*m+Z+ ddl(m,Z- ddl.m/Z/m0Z0 ddl1m2Z2 ddlm3Z3 ddl4m5Z5m6Z6 ddlm7Z7 ddl8m9Z9m:Z: ddl;Z<ddl=m>Z> ddl?m@Z@ ddlAmBZBmCZC ddlDmEZEmFZFmGZGmHZH ddlImJZJmKZKmLZLmMZM ddlNmOZOmPZPmQZQmRZRmSZSmTZTmUZUmVZVmWZWmXZXmYZYmZZZm[Z[m\Z\m]Z]m^Z^m_Z_m`Z`maZa ddlbmcZcmdZd eeefZgdahdaid d! Zjd"d# ZkejljmZmene+jodd%d&Zod'd( Zpd)d* Zqd+d, Zrd-d. Zsd/d0 Ztd1d2 Zuenejvd3d4 Zvenej$dd5d6Z$enejwd7d8 Zwd9d: Zxeye-d;d< Z,dd?d@Zzdddddd$edfdAdBZ{dCdD Z|dEdF Z}dGdH Z~dIdJ ZdKdL ZdMdN ZenejdOdP ZenejdQdR ZddSdTZdUdV ZdWdX ZenejdYdZ Zenejd[d\ Zenejd]d^ Zenejd_d` Zenejdadb Zenejdcdd Zdedf ZejddgdhZddidjZdkdl Zdmdn Zejdodp ZddqdrZddsdtZddudvZddwdxZddydzZdd{d|Zdd~dZdddZdd Zdd ZdddZdddZdd Zdd Zdd Zdd Zdd Zdd ZdddZejje_ dddZdd ZenejjdddZenejjdd ZdddZdd ZdddZdd Ze d ree de'kred ree dej epe d  ej  ene/jddddZene/jdddddZene/jdd Zene/jdd Zene/jdddZene/jdddZene/jdddZene/jdd Zene/jdddZene/jdddÄZene/j¡ddddƜddȄZene/jáddddʄZene/jġddd˜dd̈́Zene/jšdddddτZene/jơddddфZene/jǡddӄ Zene/jȡddՄ Zene/jɡdd>de3je3jddddf	ddddلZee/j̃ddddۄZee/j̓dddd݄Zene/jΡddddd߄Zene/jϡdddddZene/jСdddddZene/jѡddddZene/jҡdddddZene/jӡdddddZene/jԡdddZee/jՃdd=ddddddddddde<jddfddddZene/jסdddddZee/j؃dddddZene/j١dddddZee/jڃddddd Zene/jۡdd Zene/jܡdddZene/jݡdd Zene/jޡdddddZene/jߡddd$d	d
dZene/jdd Zene/jdd Zee/jdddddddddZee/jdddddddddddZene/jdddddZene/jdddddZene/jd$d$dddd Zene/jdddd"d#Zene/jdddd$d%Zee/jddd&d'Zene/jd(d) Zee/jdddd*d+Zene/jd,d- Zene/jd.d/ Zee/jdddd0d1Zee/jdd4d5Zene/jddd6d7Zene/jddddddd8d9d:Zene/jd;dd<d=d>Zee/jddddAdBZene/jdCdD Zene/jddEdFZene/jddGdHZene/jdddddddIdJdKZee/jdLdM Zee/jdNdO Zee/jdPdQ Zene/jdRdS Zene/jddddUdVZene/jddddWdXZene/jd$e3jd$dfdddYdZZene/jd[d\ Zene/j dÐd]d^Zene/jdĐd_d`Zene/jdŐdadbZene/jdcdd Zene/jdedf Z	dgdh Z
didj Zdkdl Zdmdn Zdodp Zdqdr Zdsdt Zdudv Zdwdx Zdydz 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)dedent
deprecatedsilent_listwarn_deprecated_string_to_bool)	docstring)FigureCanvasBase)Figure	figaspect)GridSpec)rcParamsrcParamsDefaultget_backendrcParamsOrig)
rc_context)interactive_bk)getpgetArtist)setp)AxesSubplot)	PolarAxes)mlab)get_scale_docs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)pylab_setup"_get_running_interactive_frameworkFc           	   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d	| W n tk
r|   |	| Y nX |ad
a
ddlm} |t }|r|| 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__ rJ   rJ   0lib/python3.7/site-packages/matplotlib/pyplot.py_NotIPython\   s   rL   IPythonr   )get_ipythonNc               S   s   t  rt  d S )N)
matplotlibis_interactivedraw_allrJ   rJ   rJ   rK   post_executek   s    z.install_repl_displayhook.<locals>.post_executerR   F)backend2guiT)	ExceptionsysmodulesrM   rN   _IP_REGISTEREDeventsregisterAttributeErrorZregister_post_execute_INSTALL_FIG_OBSERVERZIPython.core.pylabtoolsrS   r   r   Z
enable_guiImportError)rL   rN   iprR   rS   Zipython_gui_namerJ   rJ   rK   install_repl_displayhookR   s.    

r^   c              C   sV   t rJddlm}  |  }y|jdt  W n tk
rD   tdY nX da trRd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   )rN   rR   z*Can not unregister events in IPython < 2.0NF)rW   rM   rN   rX   Z
unregisterrZ   NotImplementedErrorr[   )rN   r]   rJ   rJ   rK   uninstall_repl_displayhook   s    r`   Tc             C   s   | d krt  } | j||dS )N)include_self)gcffindobj)omatchra   rJ   rJ   rK   rc      s    rc   c          	   C   s  t d | tjkrPx<dD ]4}yt| W n tk
r>   wY qX |td< dS qW | drf| dd nd|  }t	
|}tdtjjft|}td	| |j |j}|dk	rtj }|r|r||krtd
| |||  td< td< |a|ja|ja|ja| t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.
    all)	ZmacosxZqt5aggZqt4aggZgtk3aggZ	gtk3cairoZtkaggZwxaggZaggZcairobackendNz	module://	   zmatplotlib.backends.backend_{}BackendzLoaded backend %s version %s.zdCannot load backend {!r} which requires the {!r} interactive framework, as {!r} is currently running)closer   _auto_backend_sentinelswitch_backendr\   r   
startswithformatlower	importlibimport_moduletyperO   ZbackendsZ_Backendvars_logdebugZbackend_versionZrequired_interactive_frameworkrF   r   r   Z_backend_modnew_figure_managerdraw_if_interactiveshow_showrg   )Z
newbackend	candidateZbackend_nameZbackend_modri   Zrequired_frameworkZcurrent_frameworkrJ   rJ   rK   rl      s<    




rl   c              O   s
   t | |S )aL  
    Display a figure.
    When running in ipython with its pylab mode, display all
    figures and return to the ipython prompt.

    In non-interactive mode, display all figures and block until
    the figures have been closed; in interactive mode it has no
    effect unless figures were created prior to a change from
    non-interactive to interactive mode (not recommended).  In
    that case it displays the figures but does not block.

    A single experimental keyword argument, *block*, may be
    set to True or False to override the blocking behavior
    described above.
    )ry   )argskwrJ   rJ   rK   rx      s    rx   c               C   s   t  S )z&Return the status of interactive mode.)rO   rP   rJ   rJ   rJ   rK   isinteractive  s    r}   c               C   s   t d t  dS )zTurn the interactive mode off.FN)rO   r   r`   rJ   rJ   rJ   rK   ioff  s    
r~   c               C   s   t d t  dS )zTurn the interactive mode on.TN)rO   r   r^   rJ   rJ   rJ   rK   ion  s    
r   c             C   sL   t j }|dk	r>|j}|jjr(|  tdd ||  n
t	
|  dS )a  
    Pause 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, see
    :mod:`matplotlib.animation`.

    Notes
    -----
    This function is experimental; its behavior may be changed or extended in a
    future release.
    NF)block)r   Gcf
get_activecanvasfigureZstale	draw_idlerx   Zstart_event_looptimeZsleep)Zintervalmanagerr   rJ   rJ   rK   pause  s    

r   c             K   s   t j| f| d S )N)rO   rc)groupkwargsrJ   rJ   rK   r   ,  s    r   c             C   s   t | |S )N)rO   r   )r   fnamerJ   rJ   rK   r   1  s    r   c               C   s   t   t  rt  d S )N)rO   
rcdefaultsrP   rQ   rJ   rJ   rJ   rK   r   6  s    r   c               C   s
   t   S )a  
    Get the current colorable artist.  Specifically, returns the
    current :class:`~matplotlib.cm.ScalarMappable` instance (image or
    patch collection), or *None* if no images or patch collections
    have been defined.  The commands :func:`~matplotlib.pyplot.imshow`
    and :func:`~matplotlib.pyplot.figimage` create
    :class:`~matplotlib.image.Image` instances, and the commands
    :func:`~matplotlib.pyplot.pcolor` and
    :func:`~matplotlib.pyplot.scatter` create
    :class:`~matplotlib.collections.Collection` instances.  The
    current image is an attribute of the current axes, or the nearest
    earlier axes in the current figure that contains an image.
    )rb   Z_gcirJ   rJ   rJ   rK   gci@  s    r   c             O   s   t | f||S )N)_setp)objr{   r   rJ   rJ   rK   r   U  s    r   d      c             C   s^   t d rtdddlm} tddddg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 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   RuntimeErrorrO   r   r   Z
withStroke)scalelengthZ
randomnessr   rJ   rJ   rK   r   Z  s(    "
r   c          	      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d	 |
} q||}|	| } nt	| } t
j|   dkrt d
 }t|	|  krdkrn ntd| t t  dkrd}t| f||||||d| |rX |  jj|  fdd} jd|}| _t
j   jj}| |_t rt  trt|_|r jj    jjS )a#  
    Create a new figure.

    Parameters
    ----------

    num : integer or string, optional, default: None
        If not provided, a new figure will be created, and the figure number
        will be incremented. The figure objects holds this number in a `number`
        attribute.
        If num is provided, and a figure with this id already exists, make
        it active, and returns a reference to it. If this figure does not
        exists, create it and returns it.
        If num is a string, the window title will be set to this figure's
        `num`.

    figsize : (float, float), optional, default: None
        width, height in inches. If not provided, defaults to
        :rc:`figure.figsize` = ``[6.4, 4.8]``.

    dpi : integer, optional, default: None
        resolution of the figure. If not provided, defaults to
        :rc:`figure.dpi` = ``100``.

    facecolor :
        the background color. If not provided, defaults to
        :rc:`figure.facecolor` = ``'w'``.

    edgecolor :
        the border color. If not provided, defaults to
        :rc:`figure.edgecolor` = ``'w'``.

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

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

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

    Returns
    -------
    figure : `~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
    :func:`.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.edgecolorr1    rf   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FigureClassc                s   t j  d S )N)r   r   
set_active)Zevent)
figManagerrJ   rK   make_active  s    zfigure.<locals>.make_activeZbutton_press_event)!r   get_fignumsmax
isinstancestrget_figlabelswarningswarnindexintr   r   Zget_fig_managerlenRuntimeWarningr   ro   rv   Zset_window_titler   r   Z	set_labelmpl_connectZ_cidgcfr   ZnumberrO   rP   rw   r[   _auto_draw_if_interactiveZstale_callbackclear)numr   r   r   r   r   r   r   r   ZallnumsZnext_numZfigLabel	allLabelsZinumZmax_open_warningr   cidfigrJ   )r   rK   r     sn    E







r   c             C   s$   |r t  r | j s | j  dS )z
    This is 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)rO   rP   r   Z	is_savingr   )r   valrJ   rJ   rK   r   .  s    
r   c              C   s$   t j } | dk	r| jjS t S dS )z&Get a reference to the current figure.N)r   r   r   r   r   )r   rJ   rJ   rK   rb   <  s    
rb   c             C   s   t j| p| t kS )z3Return whether the figure with the given id exists.)r   r   Z
has_fignumr   )r   rJ   rJ   rK   fignum_existsE  s    r   c               C   s   t tjjS )z)Return a list of existing figure numbers.)sortedr   r   ZfigsrJ   rJ   rJ   rK   r   J  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 )N)r   )mrJ   rJ   rK   <lambda>R  s    zget_figlabels.<locals>.<lambda>)keyc             S   s   g | ]}|j j qS rJ   )r   r   Z	get_label).0r   rJ   rJ   rK   
<listcomp>S  s    z!get_figlabels.<locals>.<listcomp>)r   r   get_all_fig_managerssort)ZfigManagersrJ   rJ   rK   r   O  s    
r   c              C   s&   t j } | dkr"t  t j } | S )z|
    Return the figure manager of the active figure.

    If there is currently no active figure, a new one is created.
    N)r   r   r   rb   )r   rJ   rJ   rK   get_current_fig_managerV  s
    

r   c             C   s   t  j| |S )N)r   r   r   )sfuncrJ   rJ   rK   connectc  s    r   c             C   s   t  j| S )N)r   r   mpl_disconnect)r   rJ   rJ   rK   
disconnecth  s    r   c             C   s   | dkr.t j }|dkrdS t j|j n| dkrBt j  nt| trZt j|  npt| drtt j| j nVt| t	rt
 }| |krt ||  }t j| n t| trt 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

    Nrf   r   zFclose() argument must be a Figure, an int, a string, or None, not '%s')r   r   r   Zdestroyr   Zdestroy_allr   r   hasattrr   r   r   r   r   Zdestroy_fig	TypeError)r   r   r   r   rJ   rJ   rK   rj   m  s&    




rj   c               C   s   t    dS )zClear the current figure.N)rb   clfrJ   rJ   rJ   rK   r     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 (:func:`.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.

    A more object-oriented alternative, given any
    :class:`~matplotlib.figure.Figure` instance, :attr:`fig`, that
    was created using a :mod:`~matplotlib.pyplot` function, is::

        fig.canvas.draw_idle()
    N)r   r   r   rJ   rJ   rJ   rK   draw  s    r   c              O   s    t  }|j| |}|j  |S )N)rb   savefigr   r   )r{   r   r   ZresrJ   rJ   rK   r     s    
r   c              O   s   t  j| |S )z
    Blocking call to interact with the figure.

    This will wait for *n* clicks from the user and return a list of the
    coordinates of each click.

    If *timeout* is negative, does not timeout.
    )rb   ginput)r{   r   rJ   rJ   rK   r     s    
r   c              O   s   t  j| |S )a  
    Blocking call to interact with the figure.

    This will wait for *n* key or mouse clicks from the user and
    return a list containing True's for keyboard clicks and False's
    for mouse clicks.

    If *timeout* is negative, does not timeout.
    )rb   waitforbuttonpress)r{   r   rJ   rJ   rK   r     s    r   c             O   s   t  j| ||f||S )N)rb   text)xyr   r{   r   rJ   rJ   rK   figtext  s    r   c             K   s   t  j| f|S )N)rb   suptitle)tr   rJ   rJ   rK   r     s    r   c              O   s   t  j| |S )N)rb   figimage)r{   r   rJ   rJ   rK   r     s    r   c              O   s   t  j| |S )a  
    Place a legend in the figure.

    *labels*
      a sequence of strings

    *handles*
      a sequence of :class:`~matplotlib.lines.Line2D` or
      :class:`~matplotlib.patches.Patch` instances

    *loc*
      can be a string or an integer specifying the legend
      location

    A :class:`matplotlib.legend.Legend` instance is returned.

    Examples
    --------

    To make a legend from existing artists on every axes::

      figlegend()

    To make a legend for a list of lines and labels::

      figlegend( (line1, line2, line3),
                 ('label1', 'label2', 'label3'),
                 'upper right' )

    .. seealso::

       :func:`~matplotlib.pyplot.legend`

    )rb   legend)r{   r   rJ   rJ   rK   	figlegend  s    #r   c             K   sP   | dkrt d|S t| tr8tddd | }t| |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, 4-tuple, Axes }
        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.
        - `~.axes.Axes`: This is equivalent to `.pyplot.sca`.
          It sets the current axes to *arg*. Note: This implicitly
          changes the current figure to the parent of *arg*.

          .. note:: The use of an `.axes.Axes` as an argument is deprecated
                    and will be removed in v3.0. Please use `.pyplot.sca`
                    instead.

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

    polar : boolean, optional
        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.

    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

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

    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   z2.2z`Using pyplot.axes(ax) with ax an Axes argument is deprecated. Please use pyplot.sca(ax) instead.)message)r   )subplotr   r   r   scarb   add_axes)argr   axrectrJ   rJ   rK   axes  s    `

r   c             C   s   | dkrt  } | j|  dS )z
    Remove the `Axes` *ax* (defaulting to the current axes) from its figure.

    A KeyError is raised if the axes doesn't exist.
    N)gcar   delaxes)r   rJ   rJ   rK   r   {  s    r   c             C   sP   t j }x8|D ]0}| |jjjkrt j| |jj|  dS qW tddS )zj
    Set the current Axes instance to *ax*.

    The current Figure is updated to the parent of *ax*.
    Nz0Axes instance argument was not found in a figure)	r   r   r   r   r   r   r   r   
ValueError)r   Zmanagersr   rJ   rJ   rK   r     s    

r   c              K   s   t  jf | S )a  
    Get the current :class:`~matplotlib.axes.Axes` instance on the
    current figure matching the given keyword args, or create one.

    Examples
    --------
    To get the current polar axes on the current figure::

        plt.gca(projection='polar')

    If the current axes doesn't exist, or isn't a polar one, the appropriate
    axes will be created and then returned.

    See Also
    --------
    matplotlib.figure.Figure.gca : The figure's gca method.
    )rb   r   )r   rJ   rJ   rK   r     s    r   c              O   s   t | dkrd} t | dkr4t| d tr4td t }|j| |}|j}g }x.|jD ]$}||krfqX|	|jrX|
| qXW x|D ]}t| qW |S )ak  
    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(ax)

    Parameters
    ----------
    *args
        Either a 3-digit integer or three separate integers
        describing the position of the subplot. If the three
        integers are *nrows*, *ncols*, and *index* in order, 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.

        *pos* is a three digit integer, where the first digit is the
        number of rows, the second the number of columns, and the third
        the index of the subplot. i.e. fig.add_subplot(235) is the same as
        fig.add_subplot(2, 3, 5). Note that all integers must be less than
        10 for this form to work.

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

    polar : boolean, optional
        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.

    Other Parameters
    ----------------
    **kwargs
        This method also takes the keyword arguments for
        the returned axes base class. 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

    Returns
    -------
    axes : an `.axes.SubplotBase` subclass of `~.axes.Axes` (or a 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
        are used and `.projections.polar.PolarAxes` if polar projection
        are used. The returned axes is then a subplot subclass of the
        base class.

    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 suplot), 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   )r1   r1   r1   r   r   zbThe subplot index argument to subplot() appears to be a boolean. Did you intend to use subplots()?)r   r   boolr   r   rb   add_subplotbboxr   fully_overlapsappendr   )r{   r   r   ar   byebyeotherr   rJ   rJ   rK   r     s"     

r   c       
   	   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, optional, 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, optional, 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.

    num : integer or string, optional, default: None
        A `.pyplot.figure` keyword that sets the figure number or label.

    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` object or array of Axes objects.
        *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.

    Examples
    --------
    ::

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

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

        #Creates two subplots and unpacks 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)

        #Creates four polar axes, and accesses them through the returned array
        fig, axes = plt.subplots(2, 2, subplot_kw=dict(polar=True))
        axes[0, 0].plot(x, y)
        axes[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)

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

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

    )nrowsncolssharexshareysqueeze
subplot_kwgridspec_kw)r   subplots)
r   r   r   r   r   r   r   Zfig_kwr   ZaxsrJ   rJ   rK   r   J  s
    w
r   c             K   s   |dkrt  }| \}}t||j|||d}|j|f|}	|	j}
g }x.|jD ]$}||	krZqL|
|jrL|| qLW x|D ]}t| qzW |	S )a  
    Create an axis at specific location inside a regular grid.

    Parameters
    ----------
    shape : sequence of 2 ints
        Shape of grid in which to place axis.
        First entry is number of rows, second entry is number of columns.

    loc : sequence of 2 ints
        Location to place axis within grid.
        First entry is row number, second entry is column number.

    rowspan : int
        Number of rows for the axis to span to the right.

    colspan : int
        Number of columns for the axis to span downwards.

    fig : `Figure`, optional
        Figure to place axis in. Defaults to current figure.

    **kwargs
        Additional keyword arguments are handed to `add_subplot`.


    Notes
    -----
    The following call ::

        subplot2grid(shape, loc, rowspan=1, colspan=1)

    is identical to ::

        gridspec=GridSpec(shape[0], shape[1])
        subplotspec=gridspec.new_subplotspec(loc, rowspan, colspan)
        subplot(subplotspec)
    N)rowspancolspan)	rb   r   Znew_subplotspecr   r   r   r   r   r   )shapelocr   r   r   r   s1s2Zsubplotspecr   r   r   r   r   rJ   rJ   rK   subplot2grid  s"    (
r   c             C   s   | dkrt  } |  }|S )a1  
    Make a second axes that shares the *x*-axis.  The new axes will
    overlay *ax* (or the current axes if *ax* is *None*).  The ticks
    for *ax2* will be placed on the right, and the *ax2* instance is
    returned.

    .. seealso::

       :doc:`/gallery/subplots_axes_and_figures/two_scales`

    N)r   twinx)r   ax1rJ   rJ   rK   r     s    r   c             C   s   | dkrt  } |  }|S )z
    Make a second axes that shares the *y*-axis.  The new axis will
    overlay *ax* (or the current axes if *ax* is *None*).  The ticks
    for *ax2* will be placed on the top, and the *ax2* instance is
    returned.
    N)r   twiny)r   r   rJ   rJ   rK   r     s    r   c             C   s   t  }|| ||||| dS )a  
    Tune the subplot layout.

    The parameter meanings (and suggested defaults) are::

      left  = 0.125  # the left side of the subplots of the figure
      right = 0.9    # the right side of the subplots of the figure
      bottom = 0.1   # the bottom of the subplots of the figure
      top = 0.9      # the top of the subplots of the figure
      wspace = 0.2   # the amount of width reserved for space between subplots,
                     # expressed as a fraction of the average axis width
      hspace = 0.2   # the amount of height reserved for space between subplots,
                     # expressed as a fraction of the average axis height

    The actual defaults are controlled by the rc file
    N)rb   subplots_adjust)leftbottomrighttopZwspaceZhspacer   rJ   rJ   rK   r   $  s    r   c             C   s   t d }dt d< | dkr(t }|jj} n(x&tjjD ]}|jj| kr2P q2W tdtdd}|jdd t	| |}|t d< tj
| |S )	zy
    Launch a subplot tool window for a figure.

    A :class:`matplotlib.widgets.SubplotTool` instance is returned.
    ZtoolbarNoneNz$Could not find manager for targetfig)   r   )r   g?)r  )r   r   r   r   r   r   Z
_activeQuer   r   r-   r   )Z	targetfigZtbarr   ZtoolfigretrJ   rJ   rK   subplot_tool:  s    


r  HzG?c             C   s   t  j| |||d dS )ay  
    Automatically adjust subplot parameters to give specified padding.

    Parameters
    ----------
    pad : float
        Padding between the figure edge and the edges of subplots,
        as a fraction of the font size.
    h_pad, w_pad : float, optional
        Padding (height/width) between edges of adjacent subplots,
        as a fraction of the font size.  Defaults to *pad*.
    rect : tuple (left, bottom, right, top), optional
        A rectangle (left, bottom, right, top) in the normalized
        figure coordinate that the whole subplots area (including
        labels) will fit into. Default is (0, 0, 1, 1).
    )padh_padw_padr   N)rb   tight_layout)r
  r  r  r   rJ   rJ   rK   r  U  s    r  c             C   s.   t  }| dkr|  } t| } ||  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_onr   Zset_frame_on)Zonr   rJ   rJ   rK   boxi  s
    
r  c              O   s&   t  }| s|s| 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)r{   r   r   r  rJ   rJ   rK   xlim  s
    r  c              O   s&   t  }| s|s| 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)r{   r   r   r  rJ   rJ   rK   ylim  s
    r  c             K   s   t  }| dkr(|dkr(| }| }n4|dkrD|| }| }n|| }|j|f|}x|D ]}|| qbW |td|fS )a  
    Get or set the current tick locations and labels of the x-axis.

    Call signatures::

        locs, labels = xticks()           # Get locations and labels

        xticks(ticks, [labels], **kwargs)  # Set locations and labels

    Parameters
    ----------
    ticks : array_like
        A list of positions at which ticks should be placed. You can pass an
        empty list to disable xticks.

    labels : array_like, optional
        A list of explicit labels to place at the given *locs*.

    **kwargs
        :class:`.Text` properties can be used to control the appearance of
        the labels.

    Returns
    -------
    locs
        An array of label locations.
    labels
        A list of `.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
    --------
    Get the current locations and labels:

        >>> locs, labels = xticks()

    Set label locations:

        >>> xticks(np.arange(0, 1, step=0.2))

    Set text labels:

        >>> xticks(np.arange(5), ('Tom', 'Dick', 'Harry', 'Sally', 'Sue'))

    Set text labels and properties:

        >>> xticks(np.arange(12), calendar.month_name[1:13], rotation=20)

    Disable xticks:

        >>> xticks([])
    NzText xticklabel)r   Z
get_xticksZget_xticklabelsZ
set_xticksZset_xticklabelsupdater
   )tickslabelsr   r   locslrJ   rJ   rK   xticks  s    <




r  c             K   s   t  }| dkr(|dkr(| }| }n4|dkrD|| }| }n|| }|j|f|}x|D ]}|| qbW |td|fS )a  
    Get or set the current tick locations and labels of the y-axis.

    Call signatures::

        locs, labels = yticks()           # Get locations and labels

        yticks(ticks, [labels], **kwargs)  # Set locations and labels

    Parameters
    ----------
    ticks : array_like
        A list of positions at which ticks should be placed. You can pass an
        empty list to disable yticks.

    labels : array_like, optional
        A list of explicit labels to place at the given *locs*.

    **kwargs
        :class:`.Text` properties can be used to control the appearance of
        the labels.

    Returns
    -------
    locs
        An array of label locations.
    labels
        A list of `.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
    --------
    Get the current locations and labels:

        >>> locs, labels = yticks()

    Set label locations:

        >>> yticks(np.arange(0, 1, step=0.2))

    Set text labels:

        >>> yticks(np.arange(5), ('Tom', 'Dick', 'Harry', 'Sally', 'Sue'))

    Set text labels and properties:

        >>> yticks(np.arange(12), calendar.month_name[1:13], rotation=45)

    Disable yticks:

        >>> yticks([])
    NzText yticklabel)r   Z
get_yticksZget_yticklabelsZ
set_yticksZset_yticklabelsr  r
   )r  r  r   r   r  r  rJ   rJ   rK   yticks  s    <




r  c              O   s^   t  }t|tstdt| dkr:|j }|j }n|j| |\}}t	d|t	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, labels : list of `.lines.Line2D`, list of `.text.Text`
        *lines* are the radial gridlines and *labels* are the tick labels.

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

    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' ))

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


    z"rgrids only defined for polar axesr   zLine2D rgridlinezText rgridlabel)
r   r   r   r   r   ZyaxisZget_gridlinesget_ticklabelsZ
set_rgridsr
   )r{   r   r   linesr  rJ   rJ   rK   rgridse  s    :

r  c              O   s^   t  }t|tstdt| dkr:|j }|j }n|j| |\}}t	d|t	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, labels : list of `.lines.Line2D`, list of `.text.Text`
        *lines* are the theta gridlines and *labels* are the tick labels.

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

    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') )

    See Also
    --------
    .pyplot.rgrids
    .projections.polar.PolarAxes.set_thetagrids
    .Axis.get_gridlines
    .Axis.get_ticklabels
    z&thetagrids only defined for polar axesr   zLine2D thetagridlinezText thetagridlabel)
r   r   r   r   r   ZxaxisZget_ticklinesr  Zset_thetagridsr
   )r{   r   r   r  r  rJ   rJ   rK   
thetagrids  s    5

r  c               C   s   d S )NrJ   rJ   rJ   rJ   rK   plotting  s    r  c            	      sL   ddddddddd	h	  t t O  ttt fd
dt  D S )z<
    Get a sorted list of all of the plotting commands.
    	colormapscolorsr   r   get_plot_commandsr   r   r  r   c             3   s@   | ]8\}}| d s| krt|rt|kr|V  qdS )_N)rm   inspectZ
isfunction	getmodule)r   namer   )excludethis_modulerJ   rK   	<genexpr>  s    
z$get_plot_commands.<locals>.<genexpr>)setr  r!  r"  r  r   globalsitemsrJ   rJ   )r$  r%  rK   r    s    
r  c               C   s
   t tjS )a|+  
    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
    <http://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, :class:`ListedColormap` is used,
    not :class:`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
      ============= =======================================================

    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
      <http://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_drJ   rJ   rJ   rK   r  	  s     pr  c        	         s   t  } tjdtjd}g }td tdx| D ]x}t | j}d}|dk	rv||}|dk	rvt	|
ddd	}d
| }|||g t t| tt|q0W d  d	 d  }|dd d|g fdd|D  |g }d|t_dS )z
    Generates 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FunctionZDescriptionr   Nr   
 z`%s`=z{:{}} {:{}}c                s    g | ]\}}d  | |qS )z{:{}} {:{}})rn   )r   r#  summary)max_namemax_summaryrJ   rK   r     s   z1_setup_pyplot_info_docstrings.<locals>.<listcomp>)r  recompileDOTALLr   r(  __doc__re   r!  Zcleandocr   replacer   r   rn   joinr  )	ZcommandsZfirst_sentenceZrowsr#  docr.  re   Z	separatorr  rJ   )r/  r0  rK   _setup_pyplot_info_docstrings  s(    

(r8  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   )r   r   r   rb   colorbar)Zmappabler9  r   r|   r  rJ   rJ   rK   r:  )  s    r:  c             C   s&   t  }|dkrtd|| | dS )ap  
    Set the color limits of the current image.

    To apply clim to all axes images do::

      clim(0, 0.5)

    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, for example::

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

    Nz1You must first define an image, e.g., with imshow)r   r   Zset_clim)vminvmaximrJ   rJ   rK   clim9  s    r>  c             C   s4   t | } td| jd t }|dk	r0||  dS )a;  
    Set the default colormap.  Applies to the current image if any.
    See help(colormaps) for more information.

    *cmap* must be a :class:`~matplotlib.colors.Colormap` instance, or
    the name of a registered colormap.

    See :func:`matplotlib.cm.register_cmap` and
    :func:`matplotlib.cm.get_cmap`.
    image)cmapN)r"   r#   r   r#  r   set_cmap)r@  r=  rJ   rJ   rK   rA  R  s
    
rA  c             C   s   t j| |S )N)rO   r?  imread)r   rn   rJ   rJ   rK   rB  f  s    rB  c             K   s   t jj| |f|S )N)rO   r?  imsave)r   Zarrr   rJ   rJ   rK   rC  k  s    rC  c             K   sV   t | } |dkrt }n"t|t| d}|ddddg}|j| f|}t| |S )al  
    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
    -------
    image : `~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   r=  rJ   rJ   rK   rE  p  s    '
rE  c              O   s:   t   r tt ts t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 :func:`~matplotlib.pyplot.plot`.

    zMTrying to create polar plot on an axis that does not have a polar projection.T)polar)rb   Zget_axesr   r   r   r   r   plot)r{   r   r   r  rJ   rJ   rK   rH    s    


rH  r   #   ,c
          	      s  |	rt  }nt }t|dk r&td|dkr4t }ddlm} t ( t	d| t
j| |||||d W dQ R X  fdd	}||d \}}g }t|dkr|ddd}||d d
}t||}||f|
 || nt|}xtd|D ]}|r:|dkr"||d d| }}n|j|d d||d}n|dkrR|ddd}||| \}}|| ||| d
}t||}|||f|
 |r|| | r|| q|d qW |s|| |dkr|  dS )a  
    Plot the data in a file.

    *cols* is a sequence of column identifiers to plot.  An identifier
    is either an int or a string.  If it is an int, it indicates the
    column number.  If it is a string, it indicates the column header.
    matplotlib will make column headers lower case, replace spaces with
    underscores, and remove all illegal characters; so ``'Adj Close*'``
    will have name ``'adj_close'``.

    - If len(*cols*) == 1, only that column will be plotted on the *y* axis.

    - If len(*cols*) > 1, the first element will be an identifier for
      data for the *x* axis and the remaining elements will be the
      column indexes for multiple subplots if *subplots* is *True*
      (the default), or for lines in a single subplot if *subplots*
      is *False*.

    *plotfuncs*, if not *None*, is a dictionary mapping identifier to
    an :class:`~matplotlib.axes.Axes` plotting function as a string.
    Default is 'plot', other choices are 'semilogy', 'fill', 'bar',
    etc.  You must use the same type of identifier in the *cols*
    vector as you use in the *plotfuncs* dictionary, e.g., integer
    column numbers in both or column names in both. If *subplots*
    is *False*, then including any function such as 'semilogy'
    that changes the axis scaling will set the scaling for all
    columns.

    *comments*, *skiprows*, *checkrows*, *delimiter*, and *names*
    are all passed on to :func:`matplotlib.mlab.csv2rec` to
    load the data into a record array.

    If *newfig* is *True*, the plot always will be made in a new figure;
    if *False*, it will be made in the current figure if one exists,
    else in a new figure.

    kwargs are passed on to plotting functions.

    Example usage::

      # plot the 2nd and 4th column against the 1st in two subplots
      plotfile(fname, (0,1,3))

      # plot using column names; specify an alternate plot type for volume
      plotfile(fname, ('date', 'volume', 'adj_close'),
                                    plotfuncs={'volume': 'semilogy'})

    Note: plotfile is intended as a convenience for quickly plotting
    data from flat files; it is not intended as an alternative
    interface to general plotting with pyplot or matplotlib.
    r1   z%must have at least one column of dataNr   )MatplotlibDeprecationWarningignore)commentsskiprows	checkrows	delimiternamesc                sH   t | tr|  |  fS t | tr< jjt|  }| | fS tddS )z.return the name and column data for identifierz&identifier must be a string or integerN)r   r   r   ZdtyperT  r   r   )Z
identifierr#  )rrJ   rK   getname_val	  s    

zplotfile.<locals>.getname_valrI  )r   r   Zdate)r   rb   r   r   dictmatplotlib.cbookrN  r   catch_warningssimplefilterr   Zcsv2recr   r   getattr
set_ylabelranger   Zis_last_row
set_xlabelr   Zautofmt_xdate)r   ZcolsZ	plotfuncsrP  rQ  rR  rS  rT  r   Znewfigr   r   rN  rV  Zxnamer   Z	ynamelistr   funcnamer   Nir   Zynamer   rJ   )rU  rK   plotfile  sV    7











rb  c                s   d}t |d  fddS )zZAutogenerated wrappers will get their docstring from a base function
    with an addendum.r   z

c                s    t | S )N)r   copy_dedent)r   )addendumbaserJ   rK   r   9	  s    z$_autogen_docstring.<locals>.<lambda>)r   ZAppender)re  msgrJ   )rd  re  rK   _autogen_docstring4	  s    rg  Zbackend_fallbackrg   )datac            K   s$   t  j| f|d k	rd|ini |S )Nrh  )r   acorr)r   rh  r   rJ   rJ   rK   ri  R	  s    ri  c            K   s2   t  j| f|||||d|d k	r(d|ini |S )N)FsFcwindowpad_tosidesrh  )r   angle_spectrum)r   rj  rk  rl  rm  rn  rh  r   rJ   rJ   rK   ro  Y	  s    ro  c             O   s   t  j| |f||S )N)r   annotate)r   Zxyr{   r   rJ   rJ   rK   rp  c	  s    rp  c             K   s   t  j| |||f|S )N)r   arrow)r   r   ZdxZdyr   rJ   rJ   rK   rq  i	  s    rq  bothc             C   s   t  j| ||dS )N)enableaxistight)r   	autoscale)rs  rt  ru  rJ   rJ   rK   rv  o	  s    rv  c             K   s   t  jf | ||d|S )N)r   xminxmax)r   axhline)r   rw  rx  r   rJ   rJ   rK   ry  u	  s    ry  c             K   s   t  j| |f||d|S )N)rw  rx  )r   axhspan)yminymaxrw  rx  r   rJ   rJ   rK   rz  {	  s    rz  c              O   s   t  j| |S )N)r   rt  )vr   rJ   rJ   rK   rt  	  s    rt  c             K   s   t  jf | ||d|S )N)r   r{  r|  )r   axvline)r   r{  r|  r   rJ   rJ   rK   r~  	  s    r~  c             K   s   t  j| |f||d|S )N)r{  r|  )r   axvspan)rw  rx  r{  r|  r   rJ   rJ   rK   r  	  s    r  皙?center)alignrh  c            K   s0   t  j| |f|||d|d k	r&d|ini |S )N)widthr  r  rh  )r   bar)r   heightr  r  r  rh  r   rJ   rJ   rK   r  	  s    r  c             O   s"   t  j|| d k	rd| ini |S )Nrh  )r   barbs)rh  r{   r|   rJ   rJ   rK   r  	  s    r  )r  c            K   s   t  j| |f|||d|S )N)r  r  r  )r   barh)r   r  r  r  r  r   rJ   rJ   rK   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boxpropsr  
flierpropsmedianprops	meanpropscappropswhiskerpropsmanage_xticks	autorangezorderrh  )r   boxplot)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  rh  rJ   rJ   rK   r  	  s    

r  c            K   s&   t  j| |f|d k	rd|ini |S )Nrh  )r   broken_barh)ZxrangesZyrangerh  r   rJ   rJ   rK   r  	  s    r  c               C   s
   t   S )N)r   clarJ   rJ   rJ   rK   r  	  s    r  c             O   s   t  j| f||S )N)r   clabel)ZCSr{   r   rJ   rJ   rK   r  	  s    r     defaultc            K   s<   t  j| |f||||||||	|
d	|d k	r2d|ini |S )N)	NFFTrj  rk  detrendrl  noverlaprm  rn  scale_by_freqrh  )r   cohere)r   r   r  rj  rk  r  rl  r  rm  rn  r  rh  r   rJ   rJ   rK   r  	  s
    r  c             O   s8   t  j|| d k	rd| ini |}|jd k	r4t| |S )Nrh  )r   contour_ArF  )rh  r{   r   __retrJ   rJ   rK   r  	  s    
 r  c             O   s8   t  j|| d k	rd| ini |}|jd k	r4t| |S )Nrh  )r   contourfr  rF  )rh  r{   r   r  rJ   rJ   rK   r  	  s    
 r  c            K   s>   t  j| |f||||||||	|
|d
|d k	r4d|ini |S )N)
r  rj  rk  r  rl  r  rm  rn  r  return_linerh  )r   csd)r   r   r  rj  rk  r  rl  r  rm  rn  r  r  rh  r   rJ   rJ   rK   r  	  s
    r  r   c            K   sD   t  j| |f||||||||	|
||||d|d k	r:d|ini |S )N)yerrxerrfmtecolor
elinewidthcapsize	barsabovelolimsuplimsxlolimsxuplims
erroreverycapthickrh  )r   errorbar)r   r   r  r  r  r  r  r  r  r  r  r  r  r  r  rh  r   rJ   rJ   rK   r  
  s    
r  
horizontalsolidc      	   	   K   s4   t  j| f||||||d|d k	r*d|ini |S )N)orientationlineoffsetslinelengths
linewidthsr  
linestylesrh  )r   	eventplot)	r  r  r  r  r  r  r  rh  r   rJ   rJ   rK   r  
  s
    r  c             O   s"   t  j|| d k	rd| ini |S )Nrh  )r   fill)rh  r{   r   rJ   rJ   rK   r  "
  s    r  c            K   s2   t  j| |f||||d|d k	r(d|ini |S )N)y2whereinterpolatesteprh  )r   fill_between)r   Zy1r  r  r  r  rh  r   rJ   rJ   rK   r  *
  s    r  c            K   s2   t  j| |f||||d|d k	r(d|ini |S )N)x2r  r  r  rh  )r   fill_betweenx)r   Zx1r  r  r  r  rh  r   rJ   rJ   rK   r  4
  s    r  majorc             K   s   t  jf | ||d|S )N)bwhichrt  )r   grid)r  r  rt  r   rJ   rJ   rK   r  >
  s    r  ZlinearZfacec            K   sV   t  j| |f||||||||	|
|||||||d|d k	r@d|ini |}t| |S )N)Cgridsizebinsxscaleyscaleextentr@  normr;  r<  alphar  
edgecolorsreduce_C_functionmincnt	marginalsrh  )r   hexbinrF  )r   r   r  r  r  r  r  r  r@  r  r;  r<  r  r  r  r  r  r  rh  r   r  rJ   rJ   rK   r  D
  s    

r  midverticalc            K   sF   t  j| f|||||||||	|
|||||d|d k	r<d|ini |S )N)r  r]  densityweights
cumulativer  histtyper  r  rwidthlogcolorlabelstackednormedrh  )r   hist)r   r  r]  r  r  r  r  r  r  r  r  r  r  r  r  r  rh  r   rJ   rJ   rK   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cmaxrh  )r   hist2drF  )r   r   r  r]  r  r  r  r  rh  r   r  rJ   rJ   rK   r  g
  s    
r  kc            K   s2   t  j| ||f|||d|d k	r(d|ini |S )N)r  r  r  rh  )r   hlines)r   rw  rx  r  r  r  rh  r   rJ   rJ   rK   r  t
  s    r        @c            K   sR   t  j| f|||||||||	|
|||||d|d k	r<d|ini |}t| |S )N)r@  r  aspectinterpolationr  r;  r<  originr  r   
filternorm	filterradimlimresampleurlrh  )r   imshowrF  )Xr@  r  r  r  r  r;  r<  r  r  r   r  r  r  r  r  rh  r   r  rJ   rJ   rK   r  
  s    

r  c              O   s   t  j| |S )N)r   r   )r{   r   rJ   rJ   rK   r   
  s    r   c             K   s   t  jf | |d|S )N)rt  ru  )r   locator_params)rt  ru  r   rJ   rJ   rK   r  
  s    r  c              O   s   t  j| |S )N)r   loglog)r{   r   rJ   rJ   rK   r   
  s    r   c      	   	   K   s4   t  j| f||||||d|d k	r*d|ini |S )N)rj  rk  rl  rm  rn  r   rh  )r   magnitude_spectrum)	r   rj  rk  rl  rm  rn  r   rh  r   rJ   rJ   rK   r  
  s    r  )r   r   ru  c             G   s   t  j|| ||dS )N)r   r   ru  )r   margins)r   r   ru  r  rJ   rJ   rK   r  
  s    r  c               C   s
   t   S )N)r   minorticks_offrJ   rJ   rJ   rK   r  
  s    r  c               C   s
   t   S )N)r   minorticks_onrJ   rJ   rJ   rK   r  
  s    r  )r  r  r@  r;  r<  rh  c       	      O   s<   t  j|| ||||d|d k	r&d|ini |}t| |S )N)r  r  r@  r;  r<  rh  )r   pcolorrF  )	r  r  r@  r;  r<  rh  r{   r   r  rJ   rJ   rK   r  
  s    
r  Zflat)r  r  r@  r;  r<  shadingantialiasedrh  c          
   O   s@   t  j|| ||||||d|d k	r*d|ini |	}
t|
 |
S )N)r  r  r@  r;  r<  r  r  rh  )r   
pcolormeshrF  )r  r  r@  r;  r<  r  r  rh  r{   r   r  rJ   rJ   rK   r  
  s    

r  c            K   s2   t  j| f|||||d|d k	r(d|ini |S )N)rj  rk  rl  rm  rn  rh  )r   phase_spectrum)r   rj  rk  rl  rm  rn  rh  r   rJ   rJ   rK   r	  
  s    r	  333333?皙?r   r   c            C   sD   t  j| f|||||||||	|
|||||d|d k	r<d|ini S )N)exploder  r  autopctpctdistanceshadowlabeldistance
startangleradiuscounterclock
wedgeprops	textpropsr  framerotatelabelsrh  )r   pie)r   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  rh  rJ   rJ   rK   r  
  s    
r  )scalexscaleyrh  c             O   s*   t  j|| |d|d k	r d|ini |S )N)r  r  rh  )r   rI  )r  r  rh  r{   r   rJ   rJ   rK   rI  
  s    rI  rd   c            K   s2   t  j| |f||||d|d k	r(d|ini |S )N)r  tzxdateydaterh  )r   	plot_date)r   r   r  r  r  r  rh  r   rJ   rJ   rK   r  
  s    r  c            K   s<   t  j| f|||||||||	|
d
|d k	r2d|ini |S )N)
r  rj  rk  r  rl  r  rm  rn  r  r  rh  )r   psd)r   r  rj  rk  r  rl  r  rm  rn  r  r  rh  r   rJ   rJ   rK   r   	  s
    r   c             O   s.   t  j|| d k	rd| ini |}t| |S )Nrh  )r   quiverrF  )rh  r{   r|   r  rJ   rJ   rK   r!    s    r!  c             K   s   t  j| ||||f|S )N)r   	quiverkey)Qr  YUr  r|   rJ   rJ   rK   r"    s    r"  c            K   sL   t  j| |f||||||||	|
||d|d k	r6d|ini |}t| |S )N)r   cmarkerr@  r  r;  r<  r  r  vertsr  rh  )r   scatterrF  )r   r   r   r&  r'  r@  r  r;  r<  r  r  r(  r  rh  r   r  rJ   rJ   rK   r)  %  s    
r)  c              O   s   t  j| |S )N)r   semilogx)r{   r   rJ   rJ   rK   r*  4  s    r*  c              O   s   t  j| |S )N)r   semilogy)r{   r   rJ   rJ   rK   r+  :  s    r+  c            K   sV   t  j| f|||||||||	|
|||||d|d k	r<d|ini |}t|d  |S )N)r  rj  rk  r  rl  r  r@  xextentrm  rn  r  moder   r;  r<  rh  r  )r   specgramrF  )r   r  rj  rk  r  rl  r  r@  r,  rm  rn  r  r-  r   r;  r<  rh  r   r  rJ   rJ   rK   r.  @  s    r.  equalupperc             K   s8   t  j| f|||||d|}t|tjr4t| |S )N)	precisionr'  
markersizer  r  )r   spyr   r"   ZScalarMappablerF  )Zr1  r'  r2  r  r  r   r  rJ   rJ   rK   r3  Q  s    
 r3  c            O   s(   t  j| f||d k	rd|ini |S )Nrh  )r   	stackplot)r   rh  r{   r   rJ   rJ   rK   r5  ]  s    r5  )linefmt	markerfmtbasefmtr  r  rh  c             G   s.   t  j|| ||||d|d k	r&d|ini S )N)r6  r7  r8  r  r  rh  )r   stem)r6  r7  r8  r  r  rh  r{   rJ   rJ   rK   r9  e  s    
r9  Zpre)r  rh  c            O   s0   t  j| |f|d|i|d k	r&d|ini |S )Nr  rh  )r   r  )r   r   r  rh  r{   r   rJ   rJ   rK   r  p  s    r  -|>皙?c            C   sT   t  j| |||f||||||	|
||||||d|d k	r>d|ini }t|j |S )N)r  r   r  r@  r  	arrowsize
arrowstyle	minlength	transformr  start_points	maxlengthintegration_directionrh  )r   
streamplotrF  r  )r   r   ur}  r  r   r  r@  r  r<  r=  r>  r?  r  r@  rA  rB  rh  r  rJ   rJ   rK   rC  x  s    
rC  c              K   s   t  jf | S )N)r   table)r   rJ   rJ   rK   rE    s    rE  c             K   s   t  j| ||f||d|S )N)fontdictwithdash)r   r   )r   r   r   rF  rG  r   rJ   rJ   rK   r     s    r   c             K   s   t  jf d| i|S )Nrt  )r   tick_params)rt  r   rJ   rJ   rK   rH    s    rH  )rt  r   	scilimits	useOffset	useLocaleuseMathTextc             C   s   t  j| |||||dS )N)rt  r   rI  rJ  rK  rL  )r   ticklabel_format)rt  r   rI  rJ  rK  rL  rJ   rJ   rK   rM    s    rM  c              O   s$   t  j| |}|jd k	r t| |S )N)r   
tricontourr  rF  )r{   r   r  rJ   rJ   rK   rN    s    
 rN  c              O   s$   t  j| |}|jd k	r t| |S )N)r   tricontourfr  rF  )r{   r   r  rJ   rJ   rK   rO    s    
 rO  c              O   s   t  j| |}t| |S )N)r   	tripcolorrF  )r{   r   r  rJ   rJ   rK   rP    s    rP  c              O   s   t  j| |S )N)r   triplot)r{   r   rJ   rJ   rK   rQ    s    rQ        ?c	      
      C   s6   t  j| f||||||||d|	d k	r.d|	ini S )N)r  r  r  r  showextremashowmedianspoints	bw_methodrh  )r   
violinplot)
Zdatasetr  r  r  r  rS  rT  rU  rV  rh  rJ   rJ   rK   rW    s
    

rW  c            K   s2   t  j| ||f|||d|d k	r(d|ini |S )N)r  r  r  rh  )r   vlines)r   r{  r|  r  r  r  rh  r   rJ   rJ   rK   rX    s    rX  c            K   s2   t  j| |f||||d|d k	r(d|ini |S )N)r  r  	usevlinesmaxlagsrh  )r   xcorr)r   r   r  r  rY  rZ  rh  r   rJ   rJ   rK   r[    s    r[  c             C   s   t  | S )N)r   _sci)r=  rJ   rJ   rK   rF    s    rF  c             K   s   t  j| f|||d|S )N)rF  r   r
  )r   	set_title)r  rF  r   r
  r   rJ   rJ   rK   title  s    r^  c             K   s   t  j| f||d|S )N)rF  labelpad)r   r^  )xlabelrF  r_  r   rJ   rJ   rK   r`    s    r`  c             K   s   t  j| f||d|S )N)rF  r_  )r   r\  )ylabelrF  r_  r   rJ   rJ   rK   ra    s    ra  c             K   s   t  j| f|S )N)r   
set_xscale)valuer   rJ   rJ   rK   r    s    r  c             K   s   t  j| f|S )N)r   
set_yscale)rc  r   rJ   rJ   rK   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)rA  rJ   rJ   rJ   rK   re    s    re  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)rA  rJ   rJ   rJ   rK   rf    s    rf  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)rA  rJ   rJ   rJ   rK   rg  &  s    rg  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)rA  rJ   rJ   rJ   rK   rh  1  s    rh  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)rA  rJ   rJ   rJ   rK   ri  <  s    ri  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)rA  rJ   rJ   rJ   rK   rj  G  s    rj  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)rA  rJ   rJ   rJ   rK   rk  R  s    rk  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)rA  rJ   rJ   rJ   rK   rl  ]  s    rl  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)rA  rJ   rJ   rJ   rK   rm  h  s    rm  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)rA  rJ   rJ   rJ   rK   rn  s  s    rn  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)rA  rJ   rJ   rJ   rK   ro  ~  s    ro  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)rA  rJ   rJ   rJ   rK   rp    s    rp  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)rA  rJ   rJ   rJ   rK   rq    s    rq  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)rA  rJ   rJ   rJ   rK   rr    s    rr  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)rA  rJ   rJ   rJ   rK   rs    s    rs  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)rA  rJ   rJ   rJ   rK   rt    s    rt  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)rA  rJ   rJ   rJ   rK   ru    s    ru  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)rA  rJ   rJ   rJ   rK   rv    s    rv  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)rA  rJ   rJ   rJ   rK   rw    s    rw  )NNT)NN)r1   r   r   )N)N)N)r1   r1   FFTNN)r1   r1   N)N)N)NNNNNN)N)r	  NNN)N)NN)NN)NNN)NN)N)N)	rJ  NrK  r   rL  rM  NTT)NNNNN)Trr  N)r   r   r1   )r   r1   )r   r   r1   )r   r1   )r  N)r  N)NNNNNNNNNNNNNNNNNNNNNNTFN)
NNNNNNNNNN)NNr   NNNFFFFFr1   N)r  r1   r1   NNr  )r   NFN)r   NNF)Nr  rr  )NNNNFNr  r  r  NFNNFN)r  NFNNN)r  r  r   )NNNNNNNNNNr1   r  NNN)rr  N)NNNNNN)NNNNN)NNNNr
  Fr  NNTNNr  FF)rd   NTF)
NNNNNNNNNN)NNNNNNNNNNN)NNNNNNNNNNNNNNN)r   NNr/  r0  )r1   NNNNr1   r:  r;  NNNr  rr  )NF)rr  )NTrR  FTFr   N)r  r  r   )Nr  N)NN)NN(  r4  rp   r!  ZloggingZnumbersr   r1  rU   r   r   r   rO   Zmatplotlib.colorbarZmatplotlib.imager   r   r   r   rX  r   r	   r
   r   r   r   Zmatplotlib.backend_basesr   Zmatplotlib.figurer   r   Zmatplotlib.gridspecr   r   r   r   r   r   Zmatplotlib.rcsetupr   Z_interactive_bkZmatplotlib.artistr   r   r   r   r   Zmatplotlib.axesr   r   Zmatplotlib.projectionsr   r   Zmatplotlib.scaler    r!   r"   Zmatplotlib.cmr#   r$   ZnumpyrD  Zmatplotlib.colorsr%   Zmatplotlib.linesr&   Zmatplotlib.textr'   r(   Zmatplotlib.patchesr)   r*   r+   r,   Zmatplotlib.widgetsr-   r.   r/   r0   Ztickerr2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   Zmatplotlib.backendsrE   rF   Z	getLoggerrG   rt   rW   r[   r^   r`   r   rQ   rc  rc   rl   rx   r}   r~   r   r   r   r   r   copyr   r   r   rb   r   r   r   r   r   r   r   r   rj   r   r   r   r   r   r   r   r   r   r   Zdedent_interpdr   r   r   r   r   r   r   r   r   r   r  r  r  r  r  r  r  r  r  r  r  r  r8  r:  Zcolorbar_docr>  rA  r?  rB  rC  rE  rH  rb  rg  rW  __getitem____setitem__rk   ri  ro  rp  rq  rv  ry  rz  rt  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  r  r  r  r	  r  rI  r  r   r!  r"  r)  r*  r+  r.  r3  r5  r9  r  rC  rE  rH  rM  rN  rO  rP  rQ  rW  rX  r[  r\  rF  r]  r^  r^  r`  r\  ra  rb  r  rd  r  re  rf  rg  rh  ri  rj  rk  rl  rm  rn  ro  rp  rq  rr  rs  rt  ru  rv  rw  rJ   rJ   rJ   rK   <module>   s  T
5 
<

< 	*(o  }= %%MMGF s.
4  x











       


			
  	
   

  	






    

   

 



    


  	      	


   



  	

