
    G8c5                     D    d dl ZddlmZmZ ddlmZ ddZ G d d      Zy)	    N   )make_axes_locatableSize)Axesc                 2   t        |       }|t        j                  |       z  }dd|z  z
  dz  t        j                  |       z  }dd|z  z
  dz  t        j                  |       z  }|j	                  t        j                  |       ||g       |j                  |||||g       | j                  |j                  ddd             g }|	 | j                  }dD ]  }	 || j                         | j                  d	      f| | d
|}
|j                  d|	      }|
j                  |       |
j                  j                         |
j                  j                         z   D ]  }|j!                  d        	 |
j"                  j%                         D ]  }|j&                  j!                  d        	 |j)                  |
        | j                         }|D ]  }
|j+                  |
        |S # t        $ r t        |       }Y /w xY w# t        $ r Y cw xY w)zX
    Parameters
    ----------
    pad : float
        Fraction of the axes height.
    r         r   )ny1)   r   r   T)original)sharexsharey)nxnyF)r   r   AxesYAxesXset_horizontalset_verticalset_axes_locatornew_locator_axes_classAttributeErrortype
get_figureget_positionyaxisget_ticklabelsxaxisset_visibleaxisvaluesmajor_ticklabelsappendadd_axes)axpad
axes_classkwargsdividerpad_sizexsizeysizeax_rgbr   ax1locatortr!   figs                  B/usr/lib/python3/dist-packages/mpl_toolkits/axes_grid1/axes_rgb.pymake_rgb_axesr4      s    ""%GTZZ^#H#gq[DJJrN*E#gq[DJJrN*EDJJrNHe<=%5(EBC++Aqb+9:F	"J  "//4/*H 9 "29179%%r%2W%))+cii.F.F.HH 	!AMM% 	!	) 9%%11%89
 	c --/C S M-  	"bJ	"  		s$   G/ 7:H
/HH
	HHc                   &    e Zd ZdZeZdddZd Zy)RGBAxesa  
    4-panel imshow (RGB, R, G, B).

    Layout:

        +---------------+-----+
        |               |  R  |
        +               +-----+
        |      RGB      |  G  |
        +               +-----+
        |               |  B  |
        +---------------+-----+

    Subclasses can override the ``_defaultAxesClass`` attribute.

    Attributes
    ----------
    RGB : ``_defaultAxesClass``
        The axes object for the three-channel imshow.
    R : ``_defaultAxesClass``
        The axes object for the red channel imshow.
    G : ``_defaultAxesClass``
        The axes object for the green channel imshow.
    B : ``_defaultAxesClass``
        The axes object for the blue channel imshow.
    r   )r'   c                   |j                  d| j                        } ||i |x| _        }|j                         j	                  |       t        |f||d|\  | _        | _        | _        | j                  | j                  | j                  | j                  fD ]R  }|j                  dd j                  j                  d       |j                  dd j                  j                  d       T y)aJ  
        Parameters
        ----------
        pad : float, default: 0
            fraction of the axes height to put as padding.
        axes_class : matplotlib.axes.Axes

        *args
            Unpacked into axes_class() init for RGB
        **kwargs
            Unpacked into axes_class() init for RGB, R, G, B axes
        r(   )r'   r(   Nw)pop_defaultAxesClassRGBr   r%   r4   RGBr!   line	set_colormajor_ticksset_markeredgecolor)selfr'   argsr)   r(   r&   r/   s          r3   __init__zRGBAxes.__init__V   s     ZZd.D.DE
"D3F332
  $!.":J":28": HHdffdffdff5 	=CHHQK&&s+HHQK##77<	=    c           	         |j                   |j                   cxk(  r|j                   k(  s5n t        d|j                    d|j                    d|j                    d      t        j                  |||g      }t        j                  |      }||dddddf<   t        j                  |      }||dddddf<   t        j                  |      }||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 : imshow kwargs
            kwargs get unpacked into the 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npdstack
zeros_liker;   imshowr<   r=   r>   )rC   rgbr)   r;   r<   r=   r>   im_rgbim_rim_gim_bs                r3   
imshow_rgbzRGBAxes.imshow_rgbm   s.   $ 177-agg- 	AGG9Bqwwi~NP PiiAq	"MM#!Q'
MM#!Q'
MM#!Q'
 //tvv}}Q)&)tvv}}Q)&)tvv}}Q)&)tT4''rF   N)__name__
__module____qualname____doc__r   r:   rE   rU    rF   r3   r6   r6   8   s    6 "# =. (rF   r6   )g{Gz?N)	numpyrJ   axes_dividerr   r   mpl_axesr   r4   r6   rZ   rF   r3   <module>r^      s      3 .bU( U(rF   