o
    ¡:´a¾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   úF/usr/lib/python3/dist-packages/mpl_toolkits/axes_grid1/axes_divider.pyÚ__init__   s   
zDivider.__init__c                    ó   ‡ fdd„|   ¡ D ƒS )Nc                    ó   g | ]}|  ˆ ¡‘qS r   ©Zget_size©Ú.0Ús©Úrendererr   r   Ú
<listcomp>9   ó    z0Divider.get_horizontal_sizes.<locals>.<listcomp>)Úget_horizontal©r   r$   r   r#   r   Úget_horizontal_sizes8   ó   zDivider.get_horizontal_sizesc                    r   )Nc                    r   r   r   r    r#   r   r   r%   <   r&   z.Divider.get_vertical_sizes.<locals>.<listcomp>)Úget_verticalr(   r   r#   r   Úget_vertical_sizes;   r*   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   sB   d\}}| D ]\}}||7 }||7 }q|dkr|| | }|S dS )N)ç        r1   r1   r   )ÚlZ
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 ©Nr1   éÿÿÿÿ)Úappend)r2   r5   Úoffsetsr3   r4   r   r   r   Ú_calc_offsetsS   s   zDivider._calc_offsetsc                 C   ó
   || _ 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   ó   | j S )z%Return the position of the rectangle.r=   ©r   r   r   r   Úget_positione   ó   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   r?   )zReturn the anchor.)r   r@   r   r   r   Ú
get_anchorz   rB   zDivider.get_anchorc                 C   r<   )z—
        Parameters
        ----------
        h : list of :mod:`~mpl_toolkits.axes_grid1.axes_size`
            sizes for horizontal division
        N©r   )r   Úhr   r   r   Úset_horizontal~   ó   
zDivider.set_horizontalc                 C   r?   )zReturn horizontal sizes.rJ   r@   r   r   r   r'   ‡   rB   zDivider.get_horizontalc                 C   r<   )z•
        Parameters
        ----------
        v : list of :mod:`~mpl_toolkits.axes_grid1.axes_size`
            sizes for vertical division
        N©r   )r   Úvr   r   r   Úset_vertical‹   rM   zDivider.set_verticalc                 C   r?   )zReturn vertical sizes.rN   r@   r   r   r   r+   ”   rB   zDivider.get_verticalFc                 C   r<   )zE
        Parameters
        ----------
        aspect : bool
        N©r   ©r   r   r   r   r   Ú
set_aspect˜   s   
zDivider.set_aspectc                 C   r?   )zReturn aspect.rQ   r@   r   r   r   Ú
get_aspect    rB   zDivider.get_aspectc                 C   s
   || _ d S r.   ©r   )r   r   r   r   r   Úset_locator¤   s   
zDivider.set_locatorc                 C   r?   r.   rU   r@   r   r   r   Úget_locator§   s   zDivider.get_locatorc                 C   s    | j d u r	|  ¡ S |   ||¡jS r.   )r   rA   Úbounds)r   Úaxr$   r   r   r   Úget_position_runtimeª   s   
zDivider.get_position_runtimec                 C   s°  | j jj| j j \}}|  ||¡\}	}
}}|  |¡}|  |¡}|  ||| ¡}|  ||| ¡}|  ¡ rzt	||ƒ}|  
||¡}|  
||¡}|d |d  | }|d |d  | }tj |	|
||¡}tj |	|
||¡}| |  ¡ |¡}|j|j}}n|  
||¡}|  
||¡}|	|
}}|du rštjddd |d }|du r©t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
        r8   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ÚdpirZ   r)   r,   r6   rT   Úminr;   rF   rG   Úfrom_boundsÚanchoredrI   Úx0Úy0r   Úwarn_deprecated)r   ÚnxÚnyÚnx1Úny1Úaxesr$   Úfig_wÚfig_hÚxÚyÚwrK   ZhsizesZvsizesZk_hZk_vr5   ÚoxÚoyÚwwÚhhÚpbÚpb1Úpb1_anchoredre   rf   Úx1Úw1Úy1Úh1r   r   r   Úlocate°   s@   



ÿÿ&&zDivider.locatec                 C   s2   t | |||dur
|n|d |dur|ƒS |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   rh   ri   rj   rk   r   r   r   Únew_locatorê   s   
ýýzDivider.new_locatorc                 C   s–   |dkr| j  d|¡ |  jd7  _d S |dkr | j  |¡ d S |dkr4| j d|¡ |  jd7  _d S |dkr@| j |¡ d S tjg d¢|d d S )	NÚleftr   r   ÚrightÚbottomÚtop©r   r‚   rƒ   r„   ©Úposition)r   Úinsertr   r9   r   r   r   rE   )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   Ú
deprecatedr0   Ústaticmethodr6   r;   r>   rA   rH   rI   rL   r'   rP   r+   rS   rT   rV   rW   rZ   r}   r€   r‰   r“   r   r   r   r   r      s:    
ÿ


		


:r   c                   @   s*   e Zd ZdZd	dd„Zdd„ Zdd„ ZdS )
r   z`
    A callable object which returns the position and size of a given
    AxesDivider cell.
    Nc                 C   s|   || _ |j}|j}|| || | _| _|du r#tjddd |d }|du r2t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-   r[   r\   r   r^   )	Ú_axes_dividerr   r   Ú_nxÚ_nyr   rg   Ú_nx1Ú_ny1)r   Zaxes_dividerrh   ri   rj   rk   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   r}   r   rž   rŸ   r    )r   rl   r$   r   r   r   r   r   Ú__call__A  s   ûzAxesLocator.__call__c                 C   ó   t | jdƒr| j ¡ S d S ©NÚget_subplotspec)Úhasattrrœ   r¤   r@   r   r   r   r¤   M  ó   
zAxesLocator.get_subplotspecr•   )r–   r—   r˜   r™   r   r¡   r¤   r   r   r   r   r     s
    
$r   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¤   rA   r©   rX   r@   r   r   r   rA   p  s   zSubplotDivider.get_positionz3.4c                 C   s   |   ¡  | j¡S r.   )r¤   rA   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   ZrowsZ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numcolsZnumr   r   r   Úchange_geometry…  s   zSubplotDivider.change_geometryc                 C   r?   )zGet the SubplotSpec instance.)r´   r@   r   r   r   r¤   Œ  rB   zSubplotDivider.get_subplotspecc                 C   s   || _ |  | | j¡¡ dS )zSet the SubplotSpec instance.N)r´   r>   rA   r©   )r   Zsubplotspecr   r   r   r«     s   zSubplotDivider.set_subplotspec)r–   r—   r˜   r™   r   rA   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 rt |¡| _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   rl   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)Zoriginal)r¹   Ú
isinstancer   Z_axes_classÚtyper¼   rA   )r   r½   Úkwargsrl   r   r   r   Ú_get_new_axes±  s   
ÿzAxesDivider._get_new_axesFc                 K   sø   |du rt jd | j }|r3t|tjƒstj|| jd}|r-| j d|¡ |  j	d7  _	n| j 
|¡ t|tjƒsAtj|| jd}|rZ| j d|¡ |  j	d7  _	| jd| jd}n| j 
|¡ | jt| jƒd | jd}| jd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   ©rh   ri   r   )ÚmplÚrcParamsrº   r¿   r/   Ú_BaseÚfrom_anyr   rˆ   r   r9   r€   r   rD   rÂ   Úset_axes_locator©r   r`   r   Ú
pack_startrÁ   ÚlocatorrY   r   r   r   Únew_horizontal»  ó,   ÿ
zAxesDivider.new_horizontalc                 K   sø   |du rt jd | j }|r3t|tjƒstj|| jd}|r-| j d|¡ |  j	d7  _	n| j 
|¡ t|tjƒsAtj|| jd}|rZ| j d|¡ |  j	d7  _	| j| jdd}n| j 
|¡ | j| jt| jƒd d}| jd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ˆ   r   r9   r€   r   rD   rÂ   rÉ   rÊ   r   r   r   Únew_verticalê  rÎ   zAxesDivider.new_verticalr-   Úadd_to_figurezax.remove()r³   Tc                 K   s®   |dkr| j ||fddi|¤Ž}n<|dkr"| j ||fddi|¤Ž}n+|dkr3| j||fddi|¤Ž}n|dkrD| j||fddi|¤Ž}n	tjg d¢|d	 |rU| 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   rE   r
   Zadd_axes)r   r‡   r`   r   rÐ   rÁ   rY   r   r   r   Úappend_axes  s   
ÿzAxesDivider.append_axesc                 C   s*   | j d u r| j ¡ }|dkrdS dS | j S )NÚautoFT)r   r¹   rT   rR   r   r   r   rT   4  s   

zAxesDivider.get_aspectc                 C   s$   | j d u r| jjdd}|jS | j S r¾   )r   r¹   rA   rX   )r   r_   r   r   r   rA   >  s   
zAxesDivider.get_positionc                 C   s   | j d u r
| j ¡ S | j S r.   )r   r¹   rI   r@   r   r   r   rI   E  s   

zAxesDivider.get_anchorc                 C   r¢   r£   )r¥   r¹   r¤   r@   r   r   r   r¤   K  r¦   zAxesDivider.get_subplotspecr•   )NF)NT)r–   r—   r˜   r™   r   rÂ   rÍ   rÏ   r   Zdelete_parameterrÑ   rT   rA   rI   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rn|| | }|S )Nr   r8   )	rD   Ú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ÚkarrayZheightr   r   r   Ú_determine_karrayU  s    rÞ   c                 C   s<   dg}t | |ƒD ]\\}}}| |d ||  | ¡ q|S r7   )Úzipr9   )Zsummed_sizesrÝ   r:   ÚrÚar5   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Ù   r8   r   )rÞ   r;   rF   rG   rc   rd   re   rf   )ro   rp   rq   rK   rÖ   r×   rm   rn   r   rÝ   rr   rt   Zh0_rZh0_aru   rv   rw   rx   re   rf   r   r   r   Ú_locateu  s   þ
râ   c                   @   ó$   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|dƒS |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   r~   )r   rh   rj   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-   r[   r\   r   )r
   r_   r`   ra   rZ   r)   r,   râ   rI   r   rg   rF   rG   rc   )r   rh   ri   rj   rk   rl   r$   rm   rn   ro   rp   rq   rK   Z	summed_wsZequal_hsre   rf   rr   ru   ry   rz   r{   r|   r   r   r   r}   ž  s   

ÿÿ&
zHBoxDivider.locater.   r”   ©r–   r—   r˜   r™   r€   r}   r   r   r   r   rä   †  s    
	rä   c                   @   rã   )	ÚVBoxDividerzl
    A `SubplotDivider` for laying out axes vertically, while ensuring that they
    have equal widths.
    Nc                 C   s"   t | d|d|dur|ƒS |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   Nr~   )r   ri   rk   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-   r^   r\   r   )r
   r_   r`   ra   rZ   r,   r)   râ   rI   r   rg   rF   rG   rc   )r   rh   ri   rj   rk   rl   r$   rm   rn   ro   rp   rq   rK   Z	summed_hsZequal_wsrf   re   rs   rt   ry   rz   r{   r|   r   r   r   r}   Å  s   

ÿÿ
&zVBoxDivider.locater.   r”   rå   r   r   r   r   ræ   ±  s    
ræ   c                 C   s$   t | ƒ}|jddd}|  |¡ |S )Nr   rÄ   )r¸   r€   rÉ   )rl   Ú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“   )rY   rŽ   r   r   rç   r   r   r   Úmake_axes_area_auto_adjustableà  s   
ÿré   )NrŠ   N)r™   ZnumpyrÓ   Z
matplotlibrÅ   r   Zmatplotlib.axesr   Zmatplotlib.gridspecr   r   Zmatplotlib.transformsZ
transformsrF   Ú r   r/   r   r   r§   r¸   rÞ   r;   râ   rä   ræ   rè   ré   r   r   r   r   Ú<module>   s0      
=B @+'	þ