o
    jk                     @   sP   d dl mZ d dlZddlmZmZ ddlmZm	Z	 dddZ
G d	d
 d
ZdS )    )
MethodTypeN   )make_axes_locatableSize)AxesSimpleAxisArtist{Gz?c              	   K   sf  t | }|t|  }dd|  d t|  }dd|  d t|  }|t| ||g ||||||g | |jdddd g }|du rOt| }dD ]Q}	|| 	 | j
d	d
f| | d|}
|jd|	d}|
| |
j |
j  D ]}|d q{z|
j D ]}|jd qW n	 ty   Y nw ||
 qQ| 	 }|D ]}
||
 q|S )a  
    Parameters
    ----------
    ax : `~matplotlib.axes.Axes`
        Axes instance to create the RGB Axes in.
    pad : float, optional
        Fraction of the Axes height to pad.
    axes_class : `matplotlib.axes.Axes` or None, optional
        Axes class to use for the R, G, and B Axes. If None, use
        the same class as *ax*.
    **kwargs
        Forwarded to *axes_class* init for the R, G, and B Axes.
    r         r   )Zny1N)   r	   r   T)original)ZsharexZsharey)nxnyF)r   r   ZAxesYZAxesXZset_horizontalZset_verticalZset_axes_locatorZnew_locatortype
get_figureZget_positionyaxisZget_ticklabelsxaxisZset_visibleaxisvaluesZmajor_ticklabelsAttributeErrorappendadd_axes)axpad
axes_classkwargsdividerZpad_sizeZxsizeZysizeZax_rgbr   ax1Zlocatortr   Zfig r    a/var/www/html/Deteccion_Ine/venv/lib/python3.10/site-packages/mpl_toolkits/axes_grid1/axes_rgb.pymake_rgb_axes	   s@   
r"   c                   @   s*   e Zd ZdZeZddddZdd ZdS )	RGBAxesu  
    4-panel `~.Axes.imshow` (RGB, R, G, B).

    Layout::

        ┌───────────────┬─────┐
        │               │  R  │
        │               ├─────┤
        │      RGB      │  G  │
        │               ├─────┤
        │               │  B  │
        └───────────────┴─────┘

    Subclasses can override the ``_defaultAxesClass`` attribute.
    By default RGBAxes uses `.mpl_axes.Axes`.

    Attributes
    ----------
    RGB : ``_defaultAxesClass``
        The Axes object for the three-channel `~.Axes.imshow`.
    R : ``_defaultAxesClass``
        The Axes object for the red channel `~.Axes.imshow`.
    G : ``_defaultAxesClass``
        The Axes object for the green channel `~.Axes.imshow`.
    B : ``_defaultAxesClass``
        The Axes object for the blue channel `~.Axes.imshow`.
    r   )r   c             
   O   s  | d| j}||i | | _}| | t|f||d|\| _| _| _| j| j| j| jfD ]N}t	|j
trjt| }|jt|jd|jd t|jd|jd t|jd|jd t|jd|jd d	 n|j
}|d
d
 jd |d
d
 jd q3d
S )a  
        Parameters
        ----------
        pad : float, default: 0
            Fraction of the Axes height to put as padding.
        axes_class : `~matplotlib.axes.Axes`
            Axes class to use. If not provided, ``_defaultAxesClass`` is used.
        *args
            Forwarded to *axes_class* init for the RGB Axes
        **kwargs
            Forwarded to *axes_class* init for the RGB, R, G, and B Axes
        r   )r   r   r   bottomr	   topleftright)r$   r%   r&   r'   Nw)pop_defaultAxesClassRGBr   r   r"   RGB
isinstancer   r   r   ZAxisDictupdater   r   Zspinesr   lineZ	set_colorZmajor_ticksZset_markeredgecolor)selfr   argsr   r   r   r   adr    r    r!   __init__]   s.   
zRGBAxes.__init__c                 K   s
  |j |j   kr|j ksn td|j  d|j  d|j  dt|||g}t|}||dddddf< t|}||dddddf< t|}||dddddf< | jj|fi |}	| jj|fi |}
| jj|fi |}| j	j|fi |}|	|
||fS )a  
        Create the four images {rgb, r, g, b}.

        Parameters
        ----------
        r, g, b : array-like
            The red, green, and blue arrays.
        **kwargs
            Forwarded to `~.Axes.imshow` calls for the four images.

        Returns
        -------
        rgb : `~matplotlib.image.AxesImage`
        r : `~matplotlib.image.AxesImage`
        g : `~matplotlib.image.AxesImage`
        b : `~matplotlib.image.AxesImage`
        zInput shapes (z, z) do not matchNr   r   r	   )
shape
ValueErrornpZdstackZ
zeros_liker+   Zimshowr,   r-   r.   )r2   rgbr   r+   r,   r-   r.   Zim_rgbZim_rZim_gZim_br    r    r!   
imshow_rgb}   s    


zRGBAxes.imshow_rgbN)__name__
__module____qualname____doc__r   r*   r5   r<   r    r    r    r!   r#   >   s
     r#   )r   N)typesr   numpyr8   Zaxes_dividerr   r   Zmpl_axesr   r   r"   r#   r    r    r    r!   <module>   s    
5