a
    ìÝEb¾g  ã                   @   sÞ   d Z ddlZddl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 G dd	„ d	ƒZG d
d„ dƒZG dd„ deƒZG dd„ deƒZdd„ Zdd„ Zdd„ ZG dd„ deƒZG dd„ deƒZdd„ Zddd„ZdS ) zJ
Helper classes to adjust the positions of multiple axes at drawing time.
é    N)Ú_api)ÚSubplotBase)ÚSubplotSpecÚGridSpecé   )Ú	axes_sizec                   @   sä   e Zd ZdZd5dd„Zdd„ Zdd	„ Ze d
¡dd„ ƒZ	e
dd„ ƒZe
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d6d"d#„Zd$d%„ Zd&d'„ Zd(d)„ Zd*d+„ Zd7d,d-„Zd8d.d/„Zd0d1„ Zd9d3d4„ZdS ):ÚDivideraQ  
    An Axes positioning class.

    The divider is initialized with lists of horizontal and vertical sizes
    (:mod:`mpl_toolkits.axes_grid1.axes_size`) based on which a given
    rectangular area will be divided.

    The `new_locator` method then creates a callable object
    that can be used as the *axes_locator* of the axes.
    NÚCc                 C   s:   || _ || _|| _|| _|| _|| _d| _d| _d| _dS )a¹  
        Parameters
        ----------
        fig : Figure
        pos : tuple of 4 floats
            Position of the rectangle that will be divided.
        horizontal : list of :mod:`~mpl_toolkits.axes_grid1.axes_size`
            Sizes for horizontal division.
        vertical : list of :mod:`~mpl_toolkits.axes_grid1.axes_size`
            Sizes for vertical division.
        aspect : bool
            Whether overall rectangular area is reduced so that the relative
            part of the horizontal and vertical scales have the same scale.
        anchor : {'C', 'SW', 'S', 'SE', 'E', 'NE', 'N', 'NW', 'W'}
            Placement of the reduced rectangle, when *aspect* is True.
        r   N)	Ú_figÚ_posÚ_horizontalÚ	_verticalÚ_anchorÚ_aspectÚ
_xrefindexÚ
_yrefindexÚ_locator)ÚselfÚfigÚposÚ
horizontalÚverticalÚaspectÚanchor© r   úd/home/ja/django-apps/lartica_env/lib/python3.9/site-packages/mpl_toolkits/axes_grid1/axes_divider.pyÚ__init__   s    zDivider.__init__c                    s   ‡ fdd„|   ¡ D ƒS )Nc                    s   g | ]}|  ˆ ¡‘qS r   ©Úget_size©Ú.0Ús©Úrendererr   r   Ú
<listcomp>9   ó    z0Divider.get_horizontal_sizes.<locals>.<listcomp>)Úget_horizontal©r   r#   r   r"   r   Úget_horizontal_sizes8   s    zDivider.get_horizontal_sizesc                    s   ‡ fdd„|   ¡ D ƒS )Nc                    s   g | ]}|  ˆ ¡‘qS r   r   r   r"   r   r   r$   <   r%   z.Divider.get_vertical_sizes.<locals>.<listcomp>)Úget_verticalr'   r   r"   r   Úget_vertical_sizes;   s    zDivider.get_vertical_sizesú3.5c                 C   s$   t  |  ¡ ¡}t  |  ¡ ¡}||fS ©N)ÚSizeZAddListr)   r&   )r   ZvsizeZhsizer   r   r   Úget_vsize_hsize>   s    zDivider.get_vsize_hsizec                 C   sF   d\}}| D ]\}}||7 }||7 }q|dkr>|| | }|S dS d S )N)ç        r/   r/   r   )ÚlÚ
total_sizeZrs_sumZas_sumÚ_rsÚ_asÚkr   r   r   Ú_calc_kD   s    
zDivider._calc_kc                 C   s2   dg}| D ]"\}}|  |d ||  | ¡ q
|S ©Nr/   éÿÿÿÿ)Úappend)r0   r4   Úoffsetsr2   r3   r   r   r   Ú_calc_offsetsS   s    zDivider._calc_offsetsc                 C   s
   || _ dS )z¶
        Set the position of the rectangle.

        Parameters
        ----------
        pos : tuple of 4 floats
            position of the rectangle that will be divided
        N©r   )r   r   r   r   r   Úset_positionZ   s    	zDivider.set_positionc                 C   s   | j S )z%Return the position of the rectangle.r;   ©r   r   r   r   Úget_positione   s    zDivider.get_positionc                 C   s(   t |ƒdkrtjtjj|d� || _dS )a„  
        Parameters
        ----------
        anchor : (float, float) or {'C', 'SW', 'S', 'SE', 'E', 'NE', ...}
            Either an (*x*, *y*) pair of relative coordinates (0 is left or
            bottom, 1 is right or top), 'C' (center), or a cardinal direction
            ('SW', southwest, is bottom left, etc.).

        See Also
        --------
        .Axes.set_anchor
        é   )r   N)Úlenr   Úcheck_in_listÚmtransformsÚBboxZcoefsr   )r   r   r   r   r   Ú
set_anchori   s    zDivider.set_anchorc                 C   s   | j S )zReturn the anchor.)r   r=   r   r   r   Ú
get_anchorz   s    zDivider.get_anchorc                 C   s
   || _ dS )z—
        Parameters
        ----------
        h : list of :mod:`~mpl_toolkits.axes_grid1.axes_size`
            sizes for horizontal division
        N©r   )r   Úhr   r   r   Úset_horizontal~   s    zDivider.set_horizontalc                 C   s   | j S )zReturn horizontal sizes.rF   r=   r   r   r   r&   ‡   s    zDivider.get_horizontalc                 C   s
   || _ dS )z•
        Parameters
        ----------
        v : list of :mod:`~mpl_toolkits.axes_grid1.axes_size`
            sizes for vertical division
        N©r   )r   Úvr   r   r   Úset_vertical‹   s    zDivider.set_verticalc                 C   s   | j S )zReturn vertical sizes.rI   r=   r   r   r   r)   ”   s    zDivider.get_verticalFc                 C   s
   || _ dS )zE
        Parameters
        ----------
        aspect : bool
        N©r   ©r   r   r   r   r   Ú
set_aspect˜   s    zDivider.set_aspectc                 C   s   | j S )zReturn aspect.rL   r=   r   r   r   Ú
get_aspect    s    zDivider.get_aspectc                 C   s
   || _ d S r,   ©r   )r   r   r   r   r   Úset_locator¤   s    zDivider.set_locatorc                 C   s   | j S r,   rP   r=   r   r   r   Úget_locator§   s    zDivider.get_locatorc                 C   s$   | j d u r|  ¡ S |   ||¡jS d S r,   )r   r>   Úbounds)r   Úaxr#   r   r   r   Úget_position_runtimeª   s    
zDivider.get_position_runtimec                 C   s´  | j jj| j j \}}|  ||¡\}	}
}}|  |¡}|  |¡}|  ||| ¡}|  ||| ¡}|  ¡ rôt	||ƒ}|  
||¡}|  
||¡}|d |d  | }|d |d  | }tj |	|
||¡}tj |	|
||¡}| |  ¡ |¡}|j|j }}n"|  
||¡}|  
||¡}|	|
 }}|du �r6tjddd� |d }|du �rVtjddd� |d }||| |  || ||  |  }}||| |  || ||  |  }}tj ||||¡S )	a¾  
        Parameters
        ----------
        nx, nx1 : int
            Integers specifying the column-position of the
            cell. When *nx1* is None, a single *nx*-th column is
            specified. Otherwise location of columns spanning between *nx*
            to *nx1* (but excluding *nx1*-th column) is specified.
        ny, ny1 : int
            Same as *nx* and *nx1*, but for row positions.
        axes
        renderer
        r7   r   Nr+   ú‡Support for passing nx1=None to mean nx+1 is deprecated since %(since)s; in a future version, nx1=None will mean 'up to the last cell'.©Úmessager   ú‡Support for passing ny1=None to mean ny+1 is deprecated since %(since)s; in a future version, ny1=None will mean 'up to the last cell'.)r
   ÚbboxÚsizeÚdpirU   r(   r*   r5   rO   Úminr:   rB   rC   Úfrom_boundsÚanchoredrE   Úx0Úy0r   Úwarn_deprecated)r   ÚnxÚnyÚnx1Úny1Úaxesr#   Úfig_wÚfig_hÚxÚyÚwrG   ZhsizesZvsizesZk_hZk_vr4   ÚoxÚoyÚwwÚhhÚpbÚpb1Úpb1_anchoredr`   ra   Úx1Úw1Úy1Úh1r   r   r   Úlocate°   s@    




ÿ
ÿ&&zDivider.locatec                 C   s0   t | |||dur|n|d |dur&|n|d ƒS )aÜ  
        Return a new `AxesLocator` for the specified cell.

        Parameters
        ----------
        nx, nx1 : int
            Integers specifying the column-position of the
            cell. When *nx1* is None, a single *nx*-th column is
            specified. Otherwise location of columns spanning between *nx*
            to *nx1* (but excluding *nx1*-th column) is specified.
        ny, ny1 : int
            Same as *nx* and *nx1*, but for row positions.
        Nr   ©ÚAxesLocator)r   rc   rd   re   rf   r   r   r   Únew_locatorê   s
    ýzDivider.new_locatorc                 C   sŽ   |dkr&| j  d|¡ |  jd7  _nd|dkr<| j  |¡ nN|dkrb| j d|¡ |  jd7  _n(|dkrx| j |¡ ntjg d¢|d� d S )	NÚleftr   r   ÚrightÚbottomÚtop©r|   r}   r~   r   ©Úposition)r   Úinsertr   r8   r   r   r   rA   )r   r‚   r[   r   r   r   Úappend_sizeý   s    
ÿzDivider.append_sizeçš™™™™™¹?c                 C   sZ   |d u rg d¢}ddl m}m}m} |D ],}|||ƒ}||ƒ}	||	|ƒ}
|  ||
¡ q(d S )Nr€   r   )ÚPaddedÚSizeFromFuncÚGetExtentHelper)r   r†   r‡   rˆ   r„   )r   Úuse_axesÚpadÚadjust_dirsr†   r‡   rˆ   ÚdÚhelperr[   Zpadded_sizer   r   r   Úadd_auto_adjustable_area  s    

z Divider.add_auto_adjustable_area)Nr	   )F)NNNN)NN)r…   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r(   r*   r   Ú
deprecatedr.   Ústaticmethodr5   r:   r<   r>   rD   rE   rH   r&   rK   r)   rN   rO   rQ   rR   rU   rx   r{   r„   rŽ   r   r   r   r   r      s8    ÿ



		

:
r   c                   @   s*   e Zd ZdZd	dd„Zdd„ Zdd„ ZdS )
rz   z`
    A callable object which returns the position and size of a given
    AxesDivider cell.
    Nc                 C   s|   || _ |j}|j}|| ||  | _| _|du rFtjddd� |d }|du rdtjddd� |d }|| | _|| | _dS )aÃ  
        Parameters
        ----------
        axes_divider : AxesDivider
        nx, nx1 : int
            Integers specifying the column-position of the
            cell. When *nx1* is None, a single *nx*-th column is
            specified. Otherwise location of columns spanning between *nx*
            to *nx1* (but excluding *nx1*-th column) is specified.
        ny, ny1 : int
            Same as *nx* and *nx1*, but for row positions.
        Nr+   rV   rW   r   rY   )	Ú_axes_dividerr   r   Ú_nxÚ_nyr   rb   Ú_nx1Ú_ny1)r   Zaxes_dividerrc   rd   re   rf   r   r   r   r   r   r     s     ÿÿ
zAxesLocator.__init__c                 C   s>   | j j}| j j}| j  | j| | j| | j| | j| ||¡S r,   )r•   r   r   rx   r–   r—   r˜   r™   )r   rg   r#   r   r   r   r   r   Ú__call__A  s    ûzAxesLocator.__call__c                 C   s   t | jdƒr| j ¡ S d S d S ©NÚget_subplotspec)Úhasattrr•   rœ   r=   r   r   r   rœ   M  s    
zAxesLocator.get_subplotspec)NN)r�   r�   r‘   r’   r   rš   rœ   r   r   r   r   rz     s   
$rz   c                       sš   e Zd ZdZdddddœ‡ fdd„
Zdd„ Ze d	¡ed
d„ ƒƒZ	e d	¡dd„ ƒZ
ejd	ddd�dd„ ƒZejd	dd�dd„ ƒZdd„ Zdd„ Z‡  ZS )ÚSubplotDividerzT
    The Divider class whose rectangle area is specified as a subplot geometry.
    Nr	   ©r   r   r   r   c                   s@   || _ tƒ j|g d¢|pg |p g ||d� |  t ||¡¡ dS )a<  
        Parameters
        ----------
        fig : `matplotlib.figure.Figure`

        *args : tuple (*nrows*, *ncols*, *index*) or int
            The array of subplots in the figure has dimensions ``(nrows,
            ncols)``, and *index* is the index of the subplot being created.
            *index* starts at 1 in the upper left corner and increases to the
            right.

            If *nrows*, *ncols*, and *index* are all single digit numbers, then
            *args* can be passed as a single 3-digit number (e.g. 234 for
            (2, 3, 4)).
        )r   r   r   r   rŸ   N)ÚfigureÚsuperr   Úset_subplotspecr   Z_from_subplot_args)r   r   r   r   r   r   Úargs©Ú	__class__r   r   r   Y  s    þzSubplotDivider.__init__c                 C   s   |   ¡  | j¡jS )z%Return the bounds of the subplot box.)rœ   r>   r    rS   r=   r   r   r   r>   p  s    zSubplotDivider.get_positionz3.4c                 C   s   |   ¡  | j¡S r,   )rœ   r>   r    r=   r   r   r   Úfigboxt  s    zSubplotDivider.figboxc                 C   s   d S r,   r   r=   r   r   r   Úupdate_paramsy  s    zSubplotDivider.update_paramsrœ   z1(get_subplotspec returns a SubplotSpec instance.))ÚalternativeZaddendumc                 C   s"   |   ¡  ¡ \}}}}|||d fS )z*Get the subplot geometry, e.g., (2, 2, 3).r   )rœ   Úget_geometry)r   ÚrowsÚcolsZnum1Znum2r   r   r   r©   }  s    zSubplotDivider.get_geometryr¢   ©r¨   c                 C   s,   t ||ƒ|d  | _|  ¡  |  | j¡ dS )z;Change subplot geometry, e.g., from (1, 1, 1) to (2, 2, 3).r   N)r   Ú_subplotspecr§   r<   r¦   )r   ZnumrowsZnumcolsÚnumr   r   r   Úchange_geometry…  s    zSubplotDivider.change_geometryc                 C   s   | j S )zGet the SubplotSpec instance.)r­   r=   r   r   r   rœ   Œ  s    zSubplotDivider.get_subplotspecc                 C   s   || _ |  | | j¡¡ dS )zSet the SubplotSpec instance.N)r­   r<   r>   r    )r   Zsubplotspecr   r   r   r¢   �  s    zSubplotDivider.set_subplotspec)r�   r�   r‘   r’   r   r>   r   r“   Úpropertyr¦   r§   r©   r¯   rœ   r¢   Ú__classcell__r   r   r¤   r   rž   T  s&   ÿ
þ

rž   c                       s~   e Zd ZdZd‡ fdd„	Zddœdd„Zdd	d
„Zddd„Zej	dddd�ddd„ƒZ
dd„ Zdd„ Zdd„ Zdd„ Z‡  ZS ) ÚAxesDividerz1
    Divider based on the pre-existing axes.
    Nc                    sf   || _ |du rt |¡| _n|| _|du r8t |¡| _n|| _tƒ j| ¡ d| jg| jgddd� dS )zw
        Parameters
        ----------
        axes : :class:`~matplotlib.axes.Axes`
        xref
        yref
        Nr	   )r   r   r   r   r   r   )	Ú_axesr-   ZAxesXÚ_xrefZAxesYÚ_yrefr¡   r   Ú
get_figure)r   rg   ZxrefZyrefr¤   r   r   r   ›  s    þzAxesDivider.__init__)Ú
axes_classc                K   sF   | j }|d u r(t|tƒr |j}nt|ƒ}|| ¡ |jdd�fi |¤ŽS ©NT)Úoriginal)r³   Ú
isinstancer   Z_axes_classÚtyper¶   r>   )r   r·   Úkwargsrg   r   r   r   Ú_get_new_axes±  s    
ÿzAxesDivider._get_new_axesFc                 K   sø   |du rt jd | j }|rft|tjƒs8tj|| jd�}|rZ| j d|¡ |  j	d7  _	n| j 
|¡ t|tjƒs‚tj|| jd�}|r´| j d|¡ |  j	d7  _	| jd| jd�}n&| j 
|¡ | jt| jƒd | jd�}| jf i |¤Ž}| |¡ |S )ak  
        Add a new axes on the right (or left) side of the main axes.

        Parameters
        ----------
        size : :mod:`~mpl_toolkits.axes_grid1.axes_size` or float or str
            The axes width.  float or str arguments are interpreted as
            ``axes_size.from_any(size, AxesX(<main_axes>))``.
        pad : :mod:`~mpl_toolkits.axes_grid1.axes_size` or float or str
            Padding between the axes.  float or str arguments are interpreted
            as ``axes_size.from_any(size, AxesX(<main_axes>))``.  Defaults to
            :rc:`figure.subplot.wspace` times the main axes width.
        pack_start : bool
            If False, the new axes is appended at the end
            of the list, i.e., it became the right-most axes. If True, it is
            inserted at the start of the list, and becomes the left-most axes.
        **kwargs
            All extra keywords arguments are passed to the created axes.
            If *axes_class* is given, the new axes will be created as an
            instance of the given class. Otherwise, the same class of the
            main axes will be used.
        Nzfigure.subplot.wspace©Zfraction_refr   r   ©rc   rd   )ÚmplÚrcParamsr´   rº   r-   Ú_BaseÚfrom_anyr   rƒ   r   r8   r{   r   r@   r½   Úset_axes_locator©r   r[   rŠ   Ú
pack_startr¼   ÚlocatorrT   r   r   r   Únew_horizontal»  s,    ÿ
zAxesDivider.new_horizontalc                 K   sø   |du rt jd | j }|rft|tjƒs8tj|| jd�}|rZ| j d|¡ |  j	d7  _	n| j 
|¡ t|tjƒs‚tj|| jd�}|r´| j d|¡ |  j	d7  _	| j| jdd�}n&| j 
|¡ | j| jt| jƒd d�}| jf i |¤Ž}| |¡ |S )am  
        Add a new axes on the top (or bottom) side of the main axes.

        Parameters
        ----------
        size : :mod:`~mpl_toolkits.axes_grid1.axes_size` or float or str
            The axes height.  float or str arguments are interpreted as
            ``axes_size.from_any(size, AxesY(<main_axes>))``.
        pad : :mod:`~mpl_toolkits.axes_grid1.axes_size` or float or str
            Padding between the axes.  float or str arguments are interpreted
            as ``axes_size.from_any(size, AxesY(<main_axes>))``.  Defaults to
            :rc:`figure.subplot.hspace` times the main axes height.
        pack_start : bool
            If False, the new axes is appended at the end
            of the list, i.e., it became the right-most axes. If True, it is
            inserted at the start of the list, and becomes the left-most axes.
        **kwargs
            All extra keywords arguments are passed to the created axes.
            If *axes_class* is given, the new axes will be created as an
            instance of the given class. Otherwise, the same class of the
            main axes will be used.
        Nzfigure.subplot.hspacer¾   r   r   r¿   )rÀ   rÁ   rµ   rº   r-   rÂ   rÃ   r   rƒ   r   r8   r{   r   r@   r½   rÄ   rÅ   r   r   r   Únew_verticalê  s,    ÿ
zAxesDivider.new_verticalr+   Úadd_to_figurezax.remove()r¬   Tc                 K   s®   |dkr"| j ||fddi|¤Ž}nx|dkrD| j ||fddi|¤Ž}nV|dkrf| j||fddi|¤Ž}n4|dkrˆ| j||fddi|¤Ž}ntjg d¢|d	� |rª| j |¡ |S )
z÷
        Create an axes at the given *position* with the same height
        (or width) of the main axes.

         *position*
           ["left"|"right"|"bottom"|"top"]

         *size* and *pad* should be axes_grid.axes_size compatible.
        r|   rÆ   Tr}   Fr~   r   r€   r�   )rÈ   rÉ   r   rA   r
   Zadd_axes)r   r‚   r[   rŠ   rÊ   r¼   rT   r   r   r   Úappend_axes  s    
ÿzAxesDivider.append_axesc                 C   s0   | j d u r&| j ¡ }|dkr dS dS n| j S d S )NÚautoFT)r   r³   rO   rM   r   r   r   rO   4  s    

zAxesDivider.get_aspectc                 C   s(   | j d u r| jjdd�}|jS | j S d S r¸   )r   r³   r>   rS   )r   rZ   r   r   r   r>   >  s    
zAxesDivider.get_positionc                 C   s   | j d u r| j ¡ S | j S d S r,   )r   r³   rE   r=   r   r   r   rE   E  s    

zAxesDivider.get_anchorc                 C   s   t | jdƒr| j ¡ S d S d S r›   )r�   r³   rœ   r=   r   r   r   rœ   K  s    
zAxesDivider.get_subplotspec)NN)NF)NF)NT)r�   r�   r‘   r’   r   r½   rÈ   rÉ   r   Zdelete_parameterrË   rO   r>   rE   rœ   r±   r   r   r¤   r   r²   –  s   

/
/
r²   c                 C   sà   t |ƒ}t |¡j\}}t | ¡j\}}t |d |d f¡}	t |d ¡}
t |	d |…d |…f |¡ d|	d |…df< ||	dd d…f< | |
d |…< |t|ƒ |
d< tj |	|
¡}|d d… }|d }||krÜ|| | }|S )Nr   r7   )	r@   ÚnpZasarrayÚTZzerosZfill_diagonalÚsumZlinalgZsolve)Úsummed_widthsÚequal_heightsÚtotal_widthÚ
max_heightÚnZeq_rsZeq_asZsm_rsZsm_asÚAÚBZkarray_and_heightÚkarrayÚheightr   r   r   Ú_determine_karrayU  s     rÙ   c                 C   s<   dg}t | |ƒD ]&\\}}}| |d ||  | ¡ q|S r6   )Úzipr8   )Zsummed_sizesr×   r9   ÚrÚar4   r   r   r   r:   m  s    r:   c	                 C   s    t |||| || d�}	t||	ƒ}
|
d |
d  | }|d \}}|	d | | | }tj | |||¡}tj | |||¡}| ||¡}|j|j }}|||
|fS )N)rÒ   rÓ   r7   r   )rÙ   r:   rB   rC   r^   r_   r`   ra   )rj   rk   rl   rG   rÐ   rÑ   rh   ri   r   r×   rm   ro   Zh0_rZh0_arp   rq   rr   rs   r`   ra   r   r   r   Ú_locateu  s    þ
rÝ   c                   @   s$   e Zd ZdZddd„Zddd„ZdS )	ÚHBoxDividerzÅ
    A `SubplotDivider` for laying out axes horizontally, while ensuring that
    they have equal heights.

    Examples
    --------
    .. plot:: gallery/axes_grid1/demo_axes_hbox_divider.py
    Nc                 C   s    t | |d|dur|n|d dƒS )a‹  
        Create a new `AxesLocator` for the specified cell.

        Parameters
        ----------
        nx, nx1 : int
            Integers specifying the column-position of the
            cell. When *nx1* is None, a single *nx*-th column is
            specified. Otherwise location of columns spanning between *nx*
            to *nx1* (but excluding *nx1*-th column) is specified.
        r   Nr   ry   )r   rc   re   r   r   r   r{   �  s    zHBoxDivider.new_locatorc                 C   sÂ   | j jj| j j \}}|  ||¡\}	}
}}|  |¡}|  |¡}t|	|
|||||||  ¡ ƒ	\}}}}|d u r€t	j
ddd� |d }||| |  || ||  |  }}|| }}tj ||||¡S )Nr+   rV   rW   r   )r
   rZ   r[   r\   rU   r(   r*   rÝ   rE   r   rb   rB   rC   r^   )r   rc   rd   re   rf   rg   r#   rh   ri   rj   rk   rl   rG   Z	summed_wsZequal_hsr`   ra   rm   rp   rt   ru   rv   rw   r   r   r   rx   ž  s    

ÿÿ&
zHBoxDivider.locate)N)NNNN©r�   r�   r‘   r’   r{   rx   r   r   r   r   rÞ   †  s   	
rÞ   c                   @   s$   e Zd ZdZddd„Zddd„ZdS )	ÚVBoxDividerzl
    A `SubplotDivider` for laying out axes vertically, while ensuring that they
    have equal widths.
    Nc                 C   s    t | d|d|dur|n|d ƒS )a  
        Create a new `AxesLocator` for the specified cell.

        Parameters
        ----------
        ny, ny1 : int
            Integers specifying the row-position of the
            cell. When *ny1* is None, a single *ny*-th row is
            specified. Otherwise location of rows spanning between *ny*
            to *ny1* (but excluding *ny1*-th row) is specified.
        r   r   Nry   )r   rd   rf   r   r   r   r{   ·  s    zVBoxDivider.new_locatorc                 C   sÂ   | j jj| j j \}}|  ||¡\}	}
}}|  |¡}|  |¡}t|
|	|||||||  ¡ ƒ	\}}}}|d u r€t	j
ddd� |d }|| }}||| |  || ||  |  }}tj ||||¡S )Nr+   rY   rW   r   )r
   rZ   r[   r\   rU   r*   r(   rÝ   rE   r   rb   rB   rC   r^   )r   rc   rd   re   rf   rg   r#   rh   ri   rj   rk   rl   rG   Z	summed_hsZequal_wsra   r`   rn   ro   rt   ru   rv   rw   r   r   r   rx   Å  s    

ÿÿ
&zVBoxDivider.locate)N)NNNNrß   r   r   r   r   rà   ±  s   
rà   c                 C   s$   t | ƒ}|jddd�}|  |¡ |S )Nr   r¿   )r²   r{   rÄ   )rg   ÚdividerrÇ   r   r   r   Úmake_axes_locatableØ  s    
râ   r…   c                 C   s8   |d u rg d¢}t | ƒ}|d u r$| }|j|||d� d S )Nr€   )r‰   rŠ   r‹   )râ   rŽ   )rT   r‰   rŠ   r‹   rá   r   r   r   Úmake_axes_area_auto_adjustableà  s    ÿrã   )Nr…   N)r’   ÚnumpyrÍ   Z
matplotlibrÀ   r   Zmatplotlib.axesr   Zmatplotlib.gridspecr   r   Zmatplotlib.transformsZ
transformsrB   Ú r   r-   r   rz   rž   r²   rÙ   r:   rÝ   rÞ   rà   râ   rã   r   r   r   r   Ú<module>   s.     
=B @+'	  þ