a
    8gh                     @   s\   d dl mZ d dlm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 )    )cbook)Artistc                   @   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t | j dt|  dS )N<z object of z	 artists>)type__name__lenself r   d/mounts/lovelace/software/anaconda3/envs/metaDMG/lib/python3.9/site-packages/matplotlib/container.py__repr__   s    zContainer.__repr__c                 O   s   t | |d S )Nr   )tuple__new__)clsargskwargsr   r   r   r      s    zContainer.__new__Nc                 C   s0   t jdgd| _d | _|d ur&t|nd | _d S )Npchanged)Zsignals)r   ZCallbackRegistryZ
_callbacks_remove_methodstrZ_label)r
   kllabelr   r   r   __init__   s    zContainer.__init__c                 C   s<   t j| dd dD ]}|d ur|  q| jr8| |  d S )Nc                 S   s
   t | tS N)
isinstancer   )xr   r   r   <lambda>       z"Container.remove.<locals>.<lambda>)Zscalarp)r   flattenremover   )r
   cr   r   r   r      s    

zContainer.removec                 C   s   dd t | D S )Nc                 S   s   g | ]}|d ur|qS r   r   ).0childr   r   r   
<listcomp>!   r   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_labelZ	set_labelZadd_callbackZremove_callbackr   r   r   r   r   r      s   
r   c                       s*   e Zd ZdZdddd fddZ  ZS )BarContainera4  
    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.

    datavalues : None or array-like
        The underlying data values corresponding to the bars.

    orientation : {'vertical', 'horizontal'}, default: None
        If 'vertical', the bars are assumed to be vertical.
        If 'horizontal', the bars are assumed to be horizontal.

    N)
datavaluesorientationc                   s0   || _ || _|| _|| _t j|fi | d S r   )patcheserrorbarr)   r*   superr   )r
   r+   r,   r)   r*   r   	__class__r   r   r   D   s
    zBarContainer.__init__)Nr   r%   r&   r'   r   __classcell__r   r   r.   r   r(   *   s   r(   c                       s"   e Zd ZdZd fdd	Z  Z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 : A `~matplotlib.lines.Line2D` instance of x, y plot markers
          and/or line.
        - caplines : A tuple of `~matplotlib.lines.Line2D` instances of the error
          bar caps.
        - barlinecols : A tuple of `~matplotlib.collections.LineCollection` with the
          horizontal and vertical error ranges.

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

    Fc                    s*   || _ || _|| _t j|fi | d S r   )lineshas_xerrhas_yerrr-   r   )r
   r3   r4   r5   r   r.   r   r   r   f   s    zErrorbarContainer.__init__)FFr0   r   r   r.   r   r2   M   s   r2   c                       s    e Zd ZdZ fddZ  Z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 : `~matplotlib.lines.Line2D`
        The artist of the markers at the stem heads.

    stemlines : `~matplotlib.collections.LineCollection`
        The artists of the vertical lines for all stems.

    baseline : `~matplotlib.lines.Line2D`
        The artist of the horizontal baseline.
    c                    s4   |\}}}|| _ || _|| _t j|fi | dS )aZ  
        Parameters
        ----------
        markerline_stemlines_baseline : tuple
            Tuple of ``(markerline, stemlines, baseline)``.
            ``markerline`` contains the `.Line2D` 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   r7   r8   r9   r.   r   r   r      s
    

zStemContainer.__init__r0   r   r   r.   r   r6   m   s   r6   N)	Z
matplotlibr   Zmatplotlib.artistr   r   r   r(   r2   r6   r   r   r   r   <module>   s
   %# 