3
ƽh                 @   sZ   d dl mZ d dljZG dd deZG dd deZG dd deZG d	d
 d
eZdS )    )ArtistNc               @   sX   e Zd ZdZdd Zdd ZdddZd	d
 Zdd Ze	j
Z
e	jZe	jZe	jZe	jZdS )	Containerz
    Base class for containers.

    Containers are classes that collect semantically related Artists such as
    the bars of a bar plot.
    c             C   s   dj t| jt| S )Nz<{} object of {} artists>)formattype__name__len)self r	   :/tmp/pip-build-7iwl8md4/matplotlib/matplotlib/container.py__repr__   s    zContainer.__repr__c             O   s   t j| |d S )Nr   )tuple__new__)clsargskwargsr	   r	   r
   r      s    zContainer.__new__Nc             C   s&   d| _ d| _i | _d | _| j| d S )NFr   )ZeventsonZ_oidZ_propobservers_remove_method	set_label)r   kllabelr	   r	   r
   __init__   s
    zContainer.__init__c             C   s@   x*t j| dd dD ]}|d k	r|j  qW | jr<| j|  d S )Nc             S   s
   t | tS )N)
isinstancer   )xr	   r	   r
   <lambda>   s    z"Container.remove.<locals>.<lambda>)Zscalarp)cbookflattenremover   )r   cr	   r	   r
   r      s    zContainer.removec             C   s   dd t j| D S )Nc             S   s   g | ]}|d k	r|qS )Nr	   ).0childr	   r	   r
   
<listcomp>%   s    z*Container.get_children.<locals>.<listcomp>)r   r   )r   r	   r	   r
   get_children$   s    zContainer.get_children)N)r   
__module____qualname____doc__r   r   r   r   r    r   Z	get_labelr   Zadd_callbackZremove_callbackZpchangedr	   r	   r	   r
   r      s   
	r   c               @   s   e Zd ZdZdddZdS )BarContainera  
    Container for the artists of bar plots (e.g. created by `.Axes.bar`).

    The container can be treated as a tuple of the *patches* themselves.
    Additionally, you can access these and further parameters by the
    attributes.

    Attributes
    ----------
    patches : list of :class:`~matplotlib.patches.Rectangle`
        The artists of the bars.

    errorbar : None or :class:`~matplotlib.container.ErrorbarContainer`
        A container for the error bar artists if error bars are present.
        *None* otherwise.

    Nc             K   s    || _ || _tj| |f| d S )N)patcheserrorbarr   r   )r   r%   r&   r   r	   r	   r
   r   A   s    zBarContainer.__init__)N)r   r!   r"   r#   r   r	   r	   r	   r
   r$   .   s   r$   c               @   s   e Zd ZdZdddZdS )ErrorbarContainera  
    Container for the artists of error bars (e.g. created by `.Axes.errorbar`).

    The container can be treated as the *lines* tuple itself.
    Additionally, you can access these and further parameters by the
    attributes.

    Attributes
    ----------
    lines : tuple
        Tuple of ``(data_line, caplines, barlinecols)``.

        - data_line : :class:`~matplotlib.lines.Line2D` instance of
          x, y plot markers and/or line.
        - caplines : tuple of :class:`~matplotlib.lines.Line2D` instances of
          the error bar caps.
        - barlinecols : list of :class:`~matplotlib.collections.LineCollection`
          with the horizontal and vertical error ranges.

    has_xerr, has_yerr : bool
        ``True`` if the errorbar has x/y errors.

    Fc             K   s&   || _ || _|| _tj| |f| d S )N)lineshas_xerrhas_yerrr   r   )r   r(   r)   r*   r   r	   r	   r
   r   `   s    zErrorbarContainer.__init__N)FF)r   r!   r"   r#   r   r	   r	   r	   r
   r'   G   s   r'   c               @   s   e Zd ZdZdd ZdS )StemContainera  
    Container for the artists created in a :meth:`.Axes.stem` plot.

    The container can be treated like a namedtuple ``(markerline, stemlines,
    baseline)``.

    Attributes
    ----------
    markerline :  :class:`~matplotlib.lines.Line2D`
        The artist of the markers at the stem heads.

    stemlines : list of :class:`~matplotlib.lines.Line2D`
        The artists of the vertical lines for all stems.

    baseline : :class:`~matplotlib.lines.Line2D`
        The artist of the horizontal baseline.
    c             K   s0   |\}}}|| _ || _|| _tj| |f| dS )ab  
        Parameters
        ----------
        markerline_stemlines_baseline : tuple
            Tuple of ``(markerline, stemlines, baseline)``.
            ``markerline`` contains the `.LineCollection` of the markers,
            ``stemlines`` is a `.LineCollection` of the main lines,
            ``baseline`` is the `.Line2D` of the baseline.
        N)
markerline	stemlinesbaseliner   r   )r   Zmarkerline_stemlines_baseliner   r,   r-   r.   r	   r	   r
   r   y   s
    

zStemContainer.__init__N)r   r!   r"   r#   r   r	   r	   r	   r
   r+   g   s   r+   )	Zmatplotlib.artistr   Zmatplotlib.cbookr   r   r   r$   r'   r+   r	   r	   r	   r
   <module>   s
   
) 