
    hHW                         S SK Jr  S SKrS SKJr  S SKrS SKJrJ	r	  S SK
Jr  SSKJrJrJr  SSKJrJr   " S	 S
5      r\	R(                  " \S5      r " S S5      r " S S\5      r\rg)    )NumberN)
MethodType)_apicbook)SubplotSpec   )SizeSubplotDividerDivider)AxesSimpleAxisArtistc                   .   ^  \ rS rSrU 4S jrS rSrU =r$ )CbarAxesBase   c                2   > Xl         [        TU ]  " U0 UD6  g N)orientationsuper__init__)selfr   argskwargs	__class__s       S/var/www/html/env/lib/python3.13/site-packages/mpl_toolkits/axes_grid1/axes_grid.pyr   CbarAxesBase.__init__   s    &$)&)    c                 Z    U R                  SS9R                  " U4X R                  S.UD6$ )NFroot)caxlocation)
get_figurecolorbarr   )r   mappabler   s      r   r#   CbarAxesBase.colorbar   s=    E*33E)9)9E=CE 	Er   r   )__name__
__module____qualname____firstlineno__r   r#   __static_attributes____classcell__r   s   @r   r   r      s    *E Er   r   zCbar{}c                       \ rS rSrSr\r   SSSSSSSS.S jjrS	 rS
 r	S r
S rS rS rS rS rS rS rS rS rS rSrg)Grid   a  
A grid of Axes.

In Matplotlib, the Axes location (and size) is specified in normalized
figure coordinates. This may not be ideal for images that needs to be
displayed with a given aspect ratio; for example, it is difficult to
display multiple images of a same size with some fixed padding between
them.  AxesGrid can be used in such case.

Attributes
----------
axes_all : list of Axes
    A flat list of Axes. Note that you can also access this directly
    from the grid. The following is equivalent ::

        grid[i] == grid.axes_all[i]
        len(grid) == len(grid.axes_all)

axes_column : list of list of Axes
    A 2D list of Axes where the first index is the column. This results
    in the usage pattern ``grid.axes_column[col][row]``.
axes_row : list of list of Axes
    A 2D list of Axes where the first index is the row. This results
    in the usage pattern ``grid.axes_row[row][col]``.
axes_llc : Axes
    The Axes in the lower left corner.
ngrids : int
    Number of Axes in the grid.
NFTL)	share_allshare_xshare_y
label_mode
axes_classaspectc                   Uu  U l         U l        Uc  U R                   U R                  -  nO1SUs=:  a  U R                   U R                  -  ::  d  O  [        S5      eX@l        [	        [
        R                  [        R                  " US5      5      u  U l	        U l
        [        R                  " SS/US9  XPl        Uc  U R                  nO6[        U[         ["        45      (       a  Uu  p[$        R&                  " U40 UD6n[)        / / US9n[        U[*        [,        45      (       a  [/        X40 UD6U l        OP[3        U5      S	:X  a  [/        U/UQ70 UD6U l        O,[3        U5      S
:X  a  [5        X40 UD6U l        O[7        S5      eU R0                  R9                  5       n[        R:                  " U R                   U R                  4S[<        S9n[?        U R                  5       HS  nU RA                  U5      u  nnU(       a  US   =nnO U(       a  USU4   OSnU	(       a  UUS4   OSnU" XUUS9UUU4'   MU     URC                  U R                  S:X  a  SOSS9RE                  5       U l#        URH                  RE                  5       U l%        URE                  5       U l&        U RJ                  S   S   U l'        U RQ                  5         U RF                   H  nURS                  U5        M     U RU                  U
5        g)a  
Parameters
----------
fig : `.Figure`
    The parent figure.
rect : (float, float, float, float), (int, int, int), int, or     `~.SubplotSpec`
    The axes position, as a ``(left, bottom, width, height)`` tuple,
    as a three-digit subplot position code (e.g., ``(1, 2, 1)`` or
    ``121``), or as a `~.SubplotSpec`.
nrows_ncols : (int, int)
    Number of rows and columns in the grid.
ngrids : int or None, default: None
    If not None, only the first *ngrids* axes in the grid are created.
direction : {"row", "column"}, default: "row"
    Whether axes are created in row-major ("row by row") or
    column-major order ("column by column").  This also affects the
    order in which axes are accessed using indexing (``grid[index]``).
axes_pad : float or (float, float), default: 0.02
    Padding or (horizontal padding, vertical padding) between axes, in
    inches.
share_all : bool, default: False
    Whether all axes share their x- and y-axis.  Overrides *share_x*
    and *share_y*.
share_x : bool, default: True
    Whether all axes of a column share their x-axis.
share_y : bool, default: True
    Whether all axes of a row share their y-axis.
label_mode : {"L", "1", "all", "keep"}, default: "L"
    Determines which axes will get tick labels:

    - "L": All axes on the left column get vertical tick labels;
      all axes on the bottom row get horizontal tick labels.
    - "1": Only the bottom left axes is labelled.
    - "all": All axes are labelled.
    - "keep": Do not do anything.

axes_class : subclass of `matplotlib.axes.Axes`, default: `.mpl_axes.Axes`
    The type of Axes to create.
aspect : bool, default: False
    Whether the axes aspect ratio follows the aspect ratio of the data
    limits.
Nr   z7ngrids must be positive and not larger than nrows*ncols   columnrow)	direction)
horizontalverticalr7         zIncorrect rect format)dtype)r   r   )sharexshareyCF)order)+_nrows_ncols
ValueErrorngridsmapr	   Fixednpbroadcast_to_horiz_pad_size_vert_pad_sizer   check_in_list
_direction_defaultAxesClass
isinstancelisttuple	functoolspartialdictr   r   r
   _dividerlenr   	TypeErrorget_positionfullobjectrange_get_col_rowraveltolistaxes_allTaxes_columnaxes_rowaxes_llc_init_locatorsadd_axesset_label_mode)r   figrectnrows_ncolsrK   r<   axes_padr2   r3   r4   r5   r6   r7   clsr   kw
axes_arrayicolr;   rB   rC   axs                          r   r   Grid.__init__<   s   r $/ T[>[[4;;.Fv:t{{!:: MO O 47JJ!4561d1 	He,	B#//J
T5M22$KC"**39&9JR"V<dV[122*3;;DMY!^*3<<<DMY!^#C44DM344}}))+WWdkk4;;7VL
t{{#A((+HC",T"22/6AsF+D/6CF+D#-&$9JsCx  $ #((E1#s ) <<BFH 	%<<..0"))+((+B/--BLL   	J'r   c           	         U R                   R                  [        R                  " S5      U R                  /U R
                  S-
  -  [        R                  " S5      /-   5        U R                   R                  [        R                  " S5      U R                  /U R                  S-
  -  [        R                  " S5      /-   5        [        U R                  5       Hb  nU R                  U5      u  p#U R                  U   R                  U R                   R                  SU-  SU R                  S-
  U-
  -  S95        Md     g )Nr   r9   nxny)r[   set_horizontalr	   ScaledrP   rI   set_verticalrQ   rH   ra   rK   rb   re   set_axes_locatornew_locator)r   rt   ru   r;   s       r   rj   Grid._init_locators   s    $$[[^T112dkk!mDTUGWW	Y""[[^T001T[[]Ct{{ST~FVV	Xt{{#A((+HCMM!--))QWdkkAoPS>S9T)UW $r   c                     U R                   S:X  a  [        XR                  5      u  p#X#4$ [        XR                  5      u  p2X#4$ )Nr:   )rS   divmodrH   rI   )r   nru   r;   s       r   rb   Grid._get_col_row   s@    ??h&a-HC x a-HCxr   c                 ,    [        U R                  5      $ r   )r\   re   r   s    r   __len__Grid.__len__   s    4==!!r   c                      U R                   U   $ r   )re   )r   rt   s     r   __getitem__Grid.__getitem__   s    }}Qr   c                 2    U R                   U R                  4$ )zF
Return the number of rows and columns of the grid as (nrows, ncols).
)rH   rI   r   s    r   get_geometryGrid.get_geometry   s     {{DKK''r   c                 T    US   U R                   l        US   U R                  l        g)z
Set the padding between the axes.

Parameters
----------
axes_pad : (float, float)
    The padding (horizontal pad, vertical pad) in inches.
r   r   NrP   
fixed_sizerQ   )r   rp   s     r   set_axes_padGrid.set_axes_pad   s(     +31+')1!&r   c                 Z    U R                   R                  U R                  R                  4$ )zl
Return the axes padding.

Returns
-------
hpad, vpad
    Padding (horizontal pad, vertical pad) in inches.
r   r   s    r   get_axes_padGrid.get_axes_pad   s,     $$//##..0 	0r   c                 :    U R                   R                  U5        g)z%Set the aspect of the SubplotDivider.N)r[   
set_aspect)r   r7   s     r   r   Grid.set_aspect   s      (r   c                 6    U R                   R                  5       $ )z(Return the aspect of the SubplotDivider.)r[   
get_aspectr   s    r   r   Grid.get_aspect   s    }}''))r   c                 V   [         R                  " / SQUS9  [        R                  SU R                  2SU R
                  24   U R                  S-
  //S///:H  u  p#US:X  a/  [        R                  " U R                  U R
                  4S5      =pEOUS:X  a  UnUnOUS	:X  a  X#-  =pEOg[        U R                  5       H  n[        U R
                  5       H  nU R                  U   U   n[        UR                  [        5      (       aI  [        UR                  SUR                  S
   5      n	[        UR                  SUR                  S   5      n
OUR                  S
   n	UR                  S   n
U	R!                  XFU4   XFU4   S9  U
R!                  XVU4   XVU4   S9  M     M     g)ah  
Define which axes have tick labels.

Parameters
----------
mode : {"L", "1", "all", "keep"}
    The label mode:

    - "L": All axes on the left column get vertical tick labels;
      all axes on the bottom row get horizontal tick labels.
    - "1": Only the bottom left axes is labelled.
    - "all": All axes are labelled.
    - "keep": Do not do anything.
)allr1   1keep)modeNr   r   r   Tr1   r   bottomleft)
ticklabelslabel)r   rR   rN   mgridrH   rI   r_   ra   rh   rU   axisr   r   xaxisspinesyaxistoggle)r   r   is_last_rowis_first_colr   r   rt   jrv   bottom_axis	left_axiss              r   rl   Grid.set_label_mode   s    	44@HH\dkk\<DKK</0t{{Q6G5HA3%4PP 	"5=GGT[[$++$>EEFTS[ FDS['66FTt{{#A4;;']]1%a(bggz22"2288Q		(@S"TK 01bii>O PI"$''("3K "I""fTl&A,"O  DAJda4j I ( $r   c                     U R                   $ r   )r[   r   s    r   get_dividerGrid.get_divider  s    }}r   c                 :    U R                   R                  U5        g r   )r[   set_locator)r   locators     r   r   Grid.set_axes_locator  s    !!'*r   c                 6    U R                   R                  5       $ r   )r[   get_locatorr   s    r   get_axes_locatorGrid.get_axes_locator  s    }}((**r   )rS   r[   rP   rI   rH   rQ   re   rg   ri   rh   rK   Nr;   g{Gz?)r'   r(   r)   r*   __doc__r   rT   r   rj   rb   r   r   r   r   r   r   r   rl   r   r   r   r+    r   r   r/   r/      s    < 
  q( ! q(fW" (
5
0)*%JN++r   r/   c                   T   ^  \ rS rSrSr   SSSSSSSSSSS	.	U 4S
 jjjrS rSrU =r$ )	ImageGridi  a:  
A grid of Axes for Image display.

This class is a specialization of `~.axes_grid1.axes_grid.Grid` for displaying a
grid of images.  In particular, it forces all axes in a column to share their x-axis
and all axes in a row to share their y-axis.  It further provides helpers to add
colorbars to some or all axes.
NFTr1   rightz5%)	r2   r7   r5   	cbar_modecbar_locationcbar_pad	cbar_sizecbar_set_caxr6   c       	           > [         R                  " / SQU
S9  [         R                  " / SQUS9  Xl        Xl        Xl        Xl        [        TU ]  XX4XVUSSUXS9  U R                   H  nUR                  U5        M     U(       a  U R                  S:X  a(  U R                   H  nU R                  S   Ul        M     gU R                  S	:X  an  [        U R                  5       HT  u  nnU R                  U5      u  nnU R                  S
;   a  U R                  U   Ul        M@  U R                  U   Ul        MV     g[        U R                  U R                  5       H  u  nnUUl        M     gg)a"	  
Parameters
----------
fig : `.Figure`
    The parent figure.
rect : (float, float, float, float) or int
    The axes position, as a ``(left, bottom, width, height)`` tuple or
    as a three-digit subplot position code (e.g., "121").
nrows_ncols : (int, int)
    Number of rows and columns in the grid.
ngrids : int or None, default: None
    If not None, only the first *ngrids* axes in the grid are created.
direction : {"row", "column"}, default: "row"
    Whether axes are created in row-major ("row by row") or
    column-major order ("column by column").  This also affects the
    order in which axes are accessed using indexing (``grid[index]``).
axes_pad : float or (float, float), default: 0.02in
    Padding or (horizontal padding, vertical padding) between axes, in
    inches.
share_all : bool, default: False
    Whether all axes share their x- and y-axis.  Note that in any case,
    all axes in a column share their x-axis and all axes in a row share
    their y-axis.
aspect : bool, default: True
    Whether the axes aspect ratio follows the aspect ratio of the data
    limits.
label_mode : {"L", "1", "all"}, default: "L"
    Determines which axes will get tick labels:

    - "L": All axes on the left column get vertical tick labels;
      all axes on the bottom row get horizontal tick labels.
    - "1": Only the bottom left axes is labelled.
    - "all": all axes are labelled.

cbar_mode : {"each", "single", "edge", None}, default: None
    Whether to create a colorbar for "each" axes, a "single" colorbar
    for the entire grid, colorbars only for axes on the "edge"
    determined by *cbar_location*, or no colorbars.  The colorbars are
    stored in the :attr:`cbar_axes` attribute.
cbar_location : {"left", "right", "bottom", "top"}, default: "right"
cbar_pad : float, default: None
    Padding between the image axes and the colorbar axes.

    .. versionchanged:: 3.10
        ``cbar_mode="single"`` no longer adds *axes_pad* between the axes
        and the colorbar if the *cbar_location* is "left" or "bottom".

cbar_size : size specification (see `.Size.from_any`), default: "5%"
    Colorbar size.
cbar_set_cax : bool, default: True
    If True, each axes in the grid has a *cax* attribute that is bound
    to associated *cbar_axes*.
axes_class : subclass of `matplotlib.axes.Axes`, default: None
)eachsingleedgeN)r   )r   r   r   top)r   T)r<   rp   r2   r3   r4   r7   r5   r6   r   r   r   r   r   N)r   rR   _colorbar_mode_colorbar_location_colorbar_pad_colorbar_sizer   r   	cbar_axesrk   re   r    	enumeraterb   zip)r   rm   rn   ro   rK   r<   rp   r2   r7   r5   r   r   r   r   r   r6   rv   indexru   r;   r    r   s                        r   r   ImageGrid.__init__)  sO   N 	;%.	0=)6	8'"/%' 	{tF!	 	 	: ..BLL ! ""h.--B!^^A.BF ($$.!*4==!9IE2#007HC..2CC!%!4!%!4 ":  #4==$..AGB BF  B r   c           	      B   U R                   cG  U R                  S;   a  U R                  R                  U l         OU R                  R                  U l         [        U R                  5       Vs/ s HZ  n[        U R                  5      " U R                  S   R                  SS9U R                  R                  5       U R                  S9PM\     snU l        U R                  nU R                  n/ n/ n/ n/ nUS:X  Ga  US;   Ga  US:X  a  U R                  [         R"                  " U R$                  5      -  nUR'                  [         R(                  " U R*                  U5      5        UR'                  [         R(                  " U R                   U5      5        U R                  R-                  SSS	S
9n	OUS:X  a  U R.                  [         R0                  " U R$                  5      -  nUR'                  [         R(                  " U R*                  U5      5        UR'                  [         R(                  " U R                   U5      5        U R                  R-                  SS	SS9n	[        U R                  5       H!  n
U R                  U
   R3                  S5        M#     U R                  S   R5                  W	5        U R                  S   R3                  S5        [7        U R8                  S   5       GH  u  pUS:w  a  UR'                  U R                  5        U(       a$  [         R"                  " USU R                  S   S9nO0[         R"                  " U R                  S   SU R                  S   S9nUS:X  a  US:X  d  US:X  a  US:X  az  UR'                  [;        U5      5        UR'                  [         R(                  " U R*                  U5      5        UR'                  [         R(                  " U R                   U5      5        UR'                  [;        U5      5        UR'                  U5        US:X  d  GMH  US:X  d  US:X  d  GMW  XR.                  S-
  :X  d  GMl  UR'                  [         R(                  " U R                   U5      5        UR'                  [;        U5      5        UR'                  [         R(                  " U R*                  U5      5        GM     / n/ n[7        U R<                  S   S S S	2   5       GH  u  pUS:w  a  UR'                  U R                  5        U(       a$  [         R0                  " USU R                  S   S9nO0[         R0                  " U R                  S   SU R                  S   S9nUS:X  a  US:X  d  US:X  a  US:X  az  UR'                  [;        U5      5        UR'                  [         R(                  " U R*                  U5      5        UR'                  [         R(                  " U R                   U5      5        UR'                  [;        U5      5        UR'                  U5        US:X  d  GMH  US:X  d  US:X  d  GMW  XR                  S-
  :X  d  GMl  UR'                  [         R(                  " U R                   U5      5        UR'                  [;        U5      5        UR'                  [         R(                  " U R*                  U5      5        GM     [        U R                  5       GH  n
U R?                  U
5      u  pU R                  R-                  Xk   XR                  S-
  U-
     S9n	U R                  U
   R5                  U	5        US:X  a  US;   a/  U R                  R-                  X{   XR                  S-
  U-
     S9n	O4US;   a.  U R                  R-                  Xk   XR                  S-
  U-
     S9n	U R                  U
   R5                  U	5        M  US:X  d  M  US:X  a  US:X  d  US:X  ab  XR.                  S-
  :X  aP  U R                  R-                  US   XR                  S-
  U-
     S9n	U R                  U   R5                  U	5        GMn  US:X  a  XR                  S-
  :X  d  US:X  d  GM  US:X  d  GM  U R                  R-                  Xk   US   S9n	U R                  U   R5                  U	5        GM     US:X  Ga  US:X  a  U R                  [         R"                  " U R$                  5      -  nUR'                  [         R(                  " U R                   U5      5        UR'                  [         R(                  " U R*                  U5      5        U R                  R-                  SSS	S
9n	OUS:X  a  U R.                  [         R0                  " U R$                  5      -  nUR'                  [         R(                  " U R                   U5      5        UR'                  [         R(                  " U R*                  U5      5        U R                  R-                  SS	SS9n	US;   av  [        U R                  5       H!  n
U R                  U
   R3                  S5        M#     U R                  S   R5                  W	5        U R                  S   R3                  S5        GO.US:X  a;  [        U R                  5       H!  n
U R                  U
   R3                  S5        M#     OUS:X  a  US;   a  U R                  nOU R.                  n[        U5       H!  n
U R                  U
   R3                  S5        M#     [        W
S-   U R                  5       H!  nU R                  U   R3                  S5        M#     OY[        U R                  5       H@  n
U R                  U
   R3                  S5        U R                  U
   RA                  / SQSS9  MB     U R                  RC                  U5        U R                  RE                  U5        g s  snf )Nr   r   Fr   r&   r   )r   r   r   rG   )rz   r{   ny1r   )rz   nx1r{   Taxes)r7   ref_axr   r   r   r   r   ry   )r   r   )r   r   )r   r   )      ?r   MbP?r   active)which)#r   r   rP   r   rQ   ra   rK   _cbaraxes_class_factoryrT   re   r"   r[   r^   r   r   rH   r	   AxesXri   appendfrom_anyr   r   rI   AxesYset_visibler   r   rh   r\   rg   rb   set_positionr|   r~   )r   _cb_modecb_locationhvh_ax_posh_cb_posszr   rt   ru   rv   v_ax_posv_cb_posr;   countr   s                     r   rj   ImageGrid._init_locators  s	    %&&*;;%)%9%9%D%D"%)%8%8%C%C"
 4;;'	) ( $D$:$:;a +++79S9S9U 335 (	) %%--h;2D#Df$[[4::dmm#<<t':':B?@t'9'92>?--33qQB3G([[4::dmm#<<t':':B?@t'9'92>?--33qbQ3G4;;'q!--e4 (NN1..w7NN1))$/ q!12GCax--.ZZ6$--:JKZZa 0'-dmmA6FH v% F*$.3!8A't':':B?@t'9'92>?OOCF#HHRLw& F*$.3++/3It'9'92>?A't':':B?@3 36  !1!1!!4TrT!:;GCax,,-ZZ6$--:JKZZa 0'-dmmA6FH x' F*$.3!8A't':':B?@t'9'92>?OOCF#HHRLu$ F*$.3++/3It'9'92>?A't':':B?@3 <6 t{{#A((+HCmm//8=3;KKM#<M3N 0 PGMM!--g6& "33"mm77#=XkkAo6K-L 8 NG !$55"mm77#=XkkAo6K-L 8 NG q!227;F"6)cQh&'1c[[1_6L"mm77#A;8KK!Oc4I+J 8 LGNN3'88A!X-#q2H$-#("mm778=;CA; 8 HGNN3'88A5 $8 hg%[[4::dmm#<<t'9'92>?t':':B?@--33raR3H%[[4::dmm#<<t'9'92>?t':':B?@--33qbR3H..t{{+ANN1%11%8 ,q!227;q!--d34;;'q!--d3 (//5\q!--d3 "1q5$++.q!--e4 / 4;;'q!--e4q!../E5= / ? (
 	$$Q'""1%k)s   ,A!p)r   r   r   r   r   r   )	r'   r(   r)   r*   r   r   rj   r+   r,   r-   s   @r   r   r     sO      g! !&" g! g!R^& ^&r   r   )numbersr   rX   typesr   numpyrN   
matplotlibr   r   matplotlib.gridspecr   axes_dividerr	   r
   r   mpl_axesr   r   r   _make_class_factoryr   r/   r   AxesGridr   r   r   <module>r      sd        " + 7 7 ,E E  33L(K A+ A+HQ& Q&h r   