
    h                        S r SSKrSSKrSSKrSSKJrJrJrJ	r	J
r
JrJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  \R:                  " \5      r\R@                  RC                  SSS9  S r" " S	 S
\RF                  5      r$ " S S5      r%\R@                   " S S5      5       r&\&r'S r(S r)S r*\R@                    SS j5       r+\R@                  SSSSSS.S j5       r,g)a  
Colorbars are a visualization of the mapping from scalar values to colors.
In Matplotlib they are drawn into a dedicated `~.axes.Axes`.

.. note::
   Colorbars are typically created through `.Figure.colorbar` or its pyplot
   wrapper `.pyplot.colorbar`, which internally use `.Colorbar` together with
   `.make_axes_gridspec` (for `.GridSpec`-positioned Axes) or `.make_axes` (for
   non-`.GridSpec`-positioned Axes).

   End-users most likely won't need to directly use this module's API.
    N)_apicbookcollectionscmcolorscontourticker)
_docstringa  
location : None or {'left', 'right', 'top', 'bottom'}
    The location, relative to the parent Axes, where the colorbar Axes
    is created.  It also determines the *orientation* of the colorbar
    (colorbars on the left and right are vertical, colorbars at the top
    and bottom are horizontal).  If None, the location will come from the
    *orientation* if it is set (vertical colorbars on the right, horizontal
    ones at the bottom), or default to 'right' if *orientation* is unset.

orientation : None or {'vertical', 'horizontal'}
    The orientation of the colorbar.  It is preferable to set the *location*
    of the colorbar, as that also determines the *orientation*; passing
    incompatible values for *location* and *orientation* raises an exception.

fraction : float, default: 0.15
    Fraction of original Axes to use for colorbar.

shrink : float, default: 1.0
    Fraction by which to multiply the size of the colorbar.

aspect : float, default: 20
    Ratio of long to short dimensions.

pad : float, default: 0.05 if vertical, 0.15 if horizontal
    Fraction of original Axes between colorbar and new image Axes.

anchor : (float, float), optional
    The anchor point of the colorbar Axes.
    Defaults to (0.0, 0.5) if vertical; (0.5, 1.0) if horizontal.

panchor : (float, float), or *False*, optional
    The anchor point of the colorbar parent Axes. If *False*, the parent
    axes' anchor will be unchanged.
    Defaults to (1.0, 0.5) if vertical; (0.5, 0.0) if horizontal.a-	  
extend : {'neither', 'both', 'min', 'max'}
    Make pointed end(s) for out-of-range values (unless 'neither').  These are
    set for a given colormap using the colormap set_under and set_over methods.

extendfrac : {*None*, 'auto', length, lengths}
    If set to *None*, both the minimum and maximum triangular colorbar
    extensions will have a length of 5% of the interior colorbar length (this
    is the default setting).

    If set to 'auto', makes the triangular colorbar extensions the same lengths
    as the interior boxes (when *spacing* is set to 'uniform') or the same
    lengths as the respective adjacent interior boxes (when *spacing* is set to
    'proportional').

    If a scalar, indicates the length of both the minimum and maximum
    triangular colorbar extensions as a fraction of the interior colorbar
    length.  A two-element sequence of fractions may also be given, indicating
    the lengths of the minimum and maximum colorbar extensions respectively as
    a fraction of the interior colorbar length.

extendrect : bool
    If *False* the minimum and maximum colorbar extensions will be triangular
    (the default).  If *True* the extensions will be rectangular.

ticks : None or list of ticks or Locator
    If None, ticks are determined automatically from the input.

format : None or str or Formatter
    If None, `~.ticker.ScalarFormatter` is used.
    Format strings, e.g., ``"%4.2e"`` or ``"{x:.2e}"``, are supported.
    An alternative `~.ticker.Formatter` may be given instead.

drawedges : bool
    Whether to draw lines at color boundaries.

label : str
    The label on the colorbar's long axis.

boundaries, values : None or a sequence
    If unset, the colormap will be displayed on a 0-1 scale.
    If sequences, *values* must have a length 1 less than *boundaries*.  For
    each region delimited by adjacent entries in *boundaries*, the color mapped
    to the corresponding value in *values* will be used.  The size of each
    region is determined by the *spacing* parameter.
    Normally only useful for indexed colors (i.e. ``norm=NoNorm()``) or other
    unusual circumstances.

spacing : {'uniform', 'proportional'}
    For discrete colorbars (`.BoundaryNorm` or contours), 'uniform' gives each
    color the same space; 'proportional' makes the space proportional to the
    data interval.)_make_axes_kw_doc_colormap_kw_docc                  0    [         R                  " S5        g )Nz,Use the colorbar set_ticks() method instead.)r   warn_external)argskwargss     E/var/www/html/env/lib/python3.13/site-packages/matplotlib/colorbar.py_set_ticks_on_axis_warnr   v   s     	EF    c                   >   ^  \ rS rSrU 4S jrSS jrS rS rSrU =r	$ )_ColorbarSpine|   c           	         > Xl         [        TU ]	  US[        R                  " [
        R                  " S5      5      5        [        R                  R                  XR                  5        g )Ncolorbar)r      )_axsuper__init__mpathPathnpemptympatchesPatchset_transform	transAxes)selfaxes	__class__s     r   r   _ColorbarSpine.__init__}   sA    z5::bhhv6F+GH$$T>>:r   c                 <    [         R                  R                  XS9$ )N)renderer)r!   r"   get_window_extent)r%   r*   s     r   r+    _ColorbarSpine.get_window_extent   s     ~~///HHr   c                 R    [         R                  " USS9U l        Xl        SU l        g )NTclosed)r   r   _path_xystale)r%   xys     r   set_xy_ColorbarSpine.set_xy   s     ZZ40

r   c                 R    [         R                  R                  X5      nSU l        U$ )NF)r!   r"   drawr2   )r%   r*   rets      r   r7   _ColorbarSpine.draw   s"    nn!!$1

r   )r   r0   r1   r2   N)
__name__
__module____qualname____firstlineno__r   r+   r4   r7   __static_attributes____classcell__)r'   s   @r   r   r   |   s    ;
I
 r   r   c                   *    \ rS rSrSrS rS rS rSrg)_ColorbarAxesLocator   zA
Shrink the Axes if there are triangular or rectangular extends.
c                 F    Xl         UR                  R                  U l        g r:   )_cbarax_axes_locator_orig_locator)r%   cbars     r   r   _ColorbarAxesLocator.__init__   s    
!WW22r   c                    U R                   b  U R                  X5      nOUR                  SS9nU R                  R                  S:X  a  U$ U R                  R	                  5       u  pEU R                  R                  5       (       d  SUS'   U R                  R                  5       (       d  SUS'   [        U5      S-   nSU-  nUS   U-  n[        US5      (       a  UR                  S   n	OSn	U R                  R                  S	:X  a^  U	(       a'  U R                  R                  R                  X-  5        UR                  SU5      R                  SXR                  -  5      nU$ U	(       a*  U R                  R                  R                  SX-  -  5        UR                  US5      R                  XR                   -  S5      nU$ )
NToriginalneitherr      _colorbar_infoaspectFvertical)rH   get_positionrE   extend_proportional_y_extend_lower_extend_uppersumhasattrrP   orientationrF   set_box_aspectshrunk
translatedheightwidth)
r%   rF   r*   posy	extendlenlenshrinkoffsetrQ   s
             r   __call___ColorbarAxesLocator.__call__   s   )$$R2C//4/0C::	)Jzz113zz''))IaLzz''))IaL)nq S1# 2'((&&x0FF ::!!Z/

,,V];**Q'221fzz6IJC
 
 

,,Q-@A**VQ'226II3EqIC
r   c                     U R                   R                  R                  5       =(       d    [        U R                  SS 5      " 5       $ )Nget_subplotspecc                      g r:    rk   r   r   <lambda>6_ColorbarAxesLocator.get_subplotspec.<locals>.<lambda>   s    dr   )rE   rF   ri   getattrrH   r%   s    r   ri   $_ColorbarAxesLocator.get_subplotspec   s:     JJMM))+ Nt))+<lKM	Or   )rE   rH   N)	r;   r<   r=   r>   __doc__r   rf   ri   r?   rk   r   r   rB   rB      s    3 DOr   rB   c                   2   \ rS rSrSrSr S;SSSSSSSSSSSSSSSSS	.S
 jjr\S 5       r\S 5       r	\	R                  S 5       r	\S 5       r\R                  S 5       r\S 5       r\R                  S 5       r\S 5       r\R                  S 5       rS rS;S jrS rS rS rS rS;S jrS rS rS rSSS.S jrS<S  jrSS!.S" jrS# rS$ rSS%.S& jrS' rS( rS) r S* r!S+ r"S, r#S- r$S. r%S/ r&S0 r'S1 r(S=S2 jr)S3 r*S4 r+S5 r,S6 r-S7 r.  S>S8 jr/S9 r0S:r1g)?Colorbar   a"  
Draw a colorbar in an existing Axes.

Typically, colorbars are created using `.Figure.colorbar` or
`.pyplot.colorbar` and associated with `.ScalarMappable`\s (such as an
`.AxesImage` generated via `~.axes.Axes.imshow`).

In order to draw a colorbar not associated with other elements in the
figure, e.g. when showing a colormap by itself, one can create an empty
`.ScalarMappable`, or directly pass *cmap* and *norm* instead of *mappable*
to `Colorbar`.

Useful public methods are :meth:`set_label` and :meth:`add_lines`.

Attributes
----------
ax : `~matplotlib.axes.Axes`
    The `~.axes.Axes` instance in which the colorbar is drawn.
lines : list
    A list of `.LineCollection` (empty if no lines were drawn).
dividers : `.LineCollection`
    A LineCollection (empty if *drawedges* is ``False``).
2   NFuniform auto)alphalocationrT   
extendfrac
extendrectticksformatvalues
boundariesspacing	drawedgeslabelcmapnormrZ   ticklocationc          	         Uc  [         R                  " UUS9nX l        UR                  nUR                  nSn[        U[        R                  5      (       ae  UnUR                  5       nUR                  nUR                  n
UR                  nUR                  nUc  [        R                  " UR                  SS9nO/[        U[         R"                  5      (       a  UR                  5       nXl        UR&                  R)                  SU R*                  5      Ul        [/        U5      n[0        R2                  " / SQUS9  [0        R2                  " / S	QUS
9  [0        R2                  " SS/US9  Ub  Ub  UU:w  a  [5        S5      eOU=(       d    U=(       d    SnXl        [9        U 5      U R6                  l        Uc\  [        U[        R                  5      (       d  [=        USS5      SLa  UR>                  nO [A        US5      (       a  UR                  nOSnSU l!        U RE                  U5        Xl        UU l        Xl#        Xl$        XPl        [0        RJ                  " [M        SS5      [M        SS5      [M        SS5      [M        SS5      S.US9U l'        Xl(        UU l)        Xl*        UU l+        X`l,        Xpl-        / U l.        SU l/        / U l0        / U l1        U R6                  Rd                  RG                  5        H  nURg                  S5        M     [i        U R6                  5      =U l5        U R6                  Rd                  S'   [l        Rn                  " / [p        Rr                  S   /S[p        Rr                  S   -  /SS9U l:        U R6                  Rw                  U Rt                  5        SU l<        SU l=        SU l>        SU l?        US:X  a  Uc  [        U5      OUnUU lA        U R                  U5        U R                  5         [        R                  " U5      (       a$  [        R                  " U[        U5      S9U l<        OXl<        [        U	[        5      (       a.   [        R                  " U	5      U l>        U R}                  S5      nOXl>        U R                  5         [        U[        R                  5      (       a"  UR                  (       d  U R                  U5        X R6                  lM        [        U R                  [        R                  [        R                  45      (       d)  [        U R                  [        R                  5      (       a  U R6                  R                  S5        / SQU lR        U R                   H$  n[        U R6                  U[=        U U5      5        M&     U R                  U R6                  lU        U R6                  R&                  R)                  S U R                  5      U lW        U R6                  R&                  R)                  S!U R                  5      U lX        g! [4        [        4 a    [        R                  " U	5      U l>         GNf = f)"ah  
Parameters
----------
ax : `~matplotlib.axes.Axes`
    The `~.axes.Axes` instance in which the colorbar is drawn.

mappable : `.ScalarMappable`
    The mappable whose colormap and norm will be used.

    To show the colors versus index instead of on a 0-1 scale, set the
    mappable's norm to ``colors.NoNorm()``.

alpha : float
    The colorbar transparency between 0 (transparent) and 1 (opaque).

location : None or {'left', 'right', 'top', 'bottom'}
    Set the colorbar's *orientation* and *ticklocation*. Colorbars on
    the left and right are vertical, colorbars at the top and bottom
    are horizontal. The *ticklocation* is the same as *location*, so if
    *location* is 'top', the ticks are on the top. *orientation* and/or
    *ticklocation* can be provided as well and overrides the value set by
    *location*, but there will be an error for incompatible combinations.

    .. versionadded:: 3.7

%(_colormap_kw_doc)s

Other Parameters
----------------
cmap : `~matplotlib.colors.Colormap`, default: :rc:`image.cmap`
    The colormap to use.  This parameter is ignored, unless *mappable* is
    None.

norm : `~matplotlib.colors.Normalize`
    The normalization to use.  This parameter is ignored, unless *mappable*
    is None.

orientation : None or {'vertical', 'horizontal'}
    If None, use the value determined by *location*. If both
    *orientation* and *location* are None then defaults to 'vertical'.

ticklocation : {'auto', 'left', 'right', 'top', 'bottom'}
    The location of the colorbar ticks. The *ticklocation* must match
    *orientation*. For example, a horizontal colorbar can only have ticks
    at the top or the bottom. If 'auto', the ticks will be the same as
    *location*, so a colorbar to the left will have ticks to the left. If
    *location* is None, the ticks will be at the bottom for a horizontal
    colorbar and at the right for a vertical.
N)r   r   T
   nbinschangedNrR   
horizontalrZ   )rx   leftrighttopbottom)r   rv   proportional)r   /location and orientation are mutually exclusiverR   colorbar_extendFrT   rN   r   rO   )rN   bothminmax)rT   outlinezaxes.edgecolor      ?zaxes.linewidth)r   
linewidthsclip_onrx   )	_get_view	_set_view_set_view_from_bboxdrag_panxlim_changedylim_changed)Yr   ScalarMappablemappabler   r   
isinstancer   
ContourSet	get_alpha_levelscvaluesrT   filledr	   FixedLocatorlevelsmartistArtistr   	callbacksconnectupdate_normalcolorbar_cid_get_orientation_from_locationr   check_in_list	TypeErrorrF   rB   rG   rn   r   rY   ry   	set_alphar   r   check_getitemslice_insider   rZ   r   _filledr{   r|   _extend_patchessolidssolids_patcheslinesspinesset_visibler   r   r   LineCollectionmplrcParamsdividersadd_collection_locator_minorlocator
_formatter_minorformatter"_get_ticklocation_from_orientationr   	set_label_reset_locator_formatter_scaler   iterablerc   strFormatStrFormatter
ValueErrorStrMethodFormatter	_draw_all	add_lines	_colorbarr   BoundaryNormNoNormset_navigate_interactive_funcssetattr	_cbar_clacla_do_extends_extend_cid1_extend_cid2)r%   rF   r   ry   rz   rT   r{   r|   r}   r~   r   r   r   r   r   r   r   rZ   r   r   cslocation_orientationspine_xs                            r   r   Colorbar.__init__   s-   D ((d>H }}}}h 2 233BLLNEJZZFYYFYYF}++BIIR@'..11&&(E  ( 2 2 : :t))!+  >hG,+	G6%	' 	'	:  +0G#{2EG G 3 &K)=KK 4T :>x););<<&7?uL--x(("
u		$))aa!TN5B<9 &"$$! 
WW^^**,Ee$ -3A$''3JJtww~~i0#22LL!123cll+;<<=	
 	t}}-!#6! ( 0 >6> (u++-;;u"//SZHDM!Mfc""D"(";";F"COOA& %Oh 2 233HOONN8$ !tyy6#6#6"FGG4=='*<*<==GG  '#F((ADGGQa 01 ) nn GG--55D,,. GG--55D,,.5 z* D"(";";F"CDs   $,X8 8+Y'&Y'c                 z    U R                   S:X  a  U R                  R                  $ U R                  R                  $ )z-Axis that has decorations (ticks, etc) on it.rR   )rZ   rF   yaxisxaxisro   s    r   	long_axisColorbar.long_axis  s.     z)77== ww}}r   c                 6    U R                   R                  5       $ )z'Major tick `.Locator` for the colorbar.)r   get_major_locatorro   s    r   locatorColorbar.locator       ~~//11r   c                 F    U R                   R                  U5        Xl        g r:   )r   set_major_locatorr   r%   locs     r   r   r     s    ((-r   c                 6    U R                   R                  5       $ )z'Minor tick `.Locator` for the colorbar.)r   get_minor_locatorro   s    r   minorlocatorColorbar.minorlocator  r   r   c                 F    U R                   R                  U5        Xl        g r:   )r   set_minor_locatorr   r   s     r   r   r     s    ((- r   c                 6    U R                   R                  5       $ )z/Major tick label `.Formatter` for the colorbar.)r   get_major_formatterro   s    r   	formatterColorbar.formatter       ~~1133r   c                 F    U R                   R                  U5        Xl        g r:   )r   set_major_formatterr   r%   fmts     r   r   r     s    **3/r   c                 6    U R                   R                  5       $ )z)Minor tick `.Formatter` for the colorbar.)r   get_minor_formatterro   s    r   minorformatterColorbar.minorformatter  r   r   c                 F    U R                   R                  U5        Xl        g r:   )r   set_minor_formatterr   r  s     r   r  r    s    **3/"r   c                     U R                    H  n[        U R                  U5        M     U R                  ?U R                  R                  5         g)z1Function to clear the interactive colorbar state.N)r   delattrrF   r   )r%   r   s     r   r   Colorbar._cbar_cla  s8    ((ADGGQ ) GGKr   c                    U(       a  Xl         [        R                  SU R                   R                  U R                  5        U R	                  U R                   R                  5       5        U R                   R                  U l        U R                   R                  U R                  :w  a+  U R                   R                  U l        U R                  5         U R                  5         [        U R                   [        R                  5      (       a.  U R                   nUR                  (       d  U R                  U5        SU l        g)a  
Update solid patches, lines, etc.

This is meant to be called when the norm of the image or contour plot
to which this colorbar belongs changes.

If the norm on the mappable is different than before, this resets the
locator and formatter for the axis, so if these have been customized,
they will need to be customized again.  However, if the norm only
changes values of *vmin*, *vmax* or *cmap* then the old formatter
and locator will be preserved.
zcolorbar update normal %r %rTN)r   _logdebugr   r   r   r   r   r   r   r   r   r   r   r2   )r%   r   CSs      r   r   Colorbar.update_normal  s      %M

14==3E3EtyyQt}}..01MM&&	==***DI//1dmmW%7%788B99r"
r   c                     U R                   S:X  a)  [        R                  S   (       a  U R                  5         O([        R                  S   (       a  U R                  5         U R                  R                  U R                  U R                  S9  U R                  5       R                  / 5        U R                  5       R                  / SS9  U R                  5         U R                  U R                     SS/   u  U l        U l        U R                  5       u  pU R                  5         U R                  U R                  pCU R                  R!                  5       (       a  XCpCU R                   S:X  a8  U R"                  R%                  SS	5        U R"                  R'                  X45        O7U R"                  R'                  SS	5        U R"                  R%                  X45        U R)                  5         U R*                  (       a  [,        R.                  " [1        U R2                  5      5      nU R5                  5       (       a  US	S
 nU R7                  5       (       a  US
S nU R9                  XU R2                  U[,        R:                  4   5        g
g
)z[
Calculate any free parameters based on the current cmap and norm,
and do all the drawing.
rR   zytick.minor.visiblezxtick.minor.visible)label_positionticks_positionTminorr   r   rO   N)rZ   r   r   minorticks_onr   setr   _short_axis	set_ticks_process_values_boundariesr   vminvmax_meshr   get_invertedrF   set_xlimset_ylimupdate_ticksr   r   arangerc   _valuesrV   rW   _add_solidsnewaxis)r%   XYlowerupperinds         r   r   Colorbar._draw_all  s   
 z)||12""$||12""$$*;*;-1->-> 	 	@$$R($$Rt$4 	  $//=q"gF	49zz| 	yy$))u>>&&(( 5z)GGQ"GGU*GGQ"GGU* 	<<))C-.C!!##!"g!!###2hQ4<<RZZ#@A r   c                    U R                   b  U R                   R                  5         U R                   H  nUR                  5         M     [        U SS5      n[	        U[
        R                  5      (       a4  [        S UR                   5       5      (       a  U R                  XX55        OU R                  R                  XX0R                  U R                  U R                  SSS9U l         U R                  (       d>  [!        U R"                  5      U R$                  :  a  U R                   R'                  S5        U R)                  5         g)z+Draw the colors; optionally add separators.Nr   c              3   (   #    U  H  oS Lv   M
     g 7fr:   rk   .0hatchs     r   	<genexpr>'Colorbar._add_solids.<locals>.<genexpr>G       H7GeT)7G   noneflat)r   r   ry   
edgecolorsshadingT)r   remover   rn   r   r   r   anyhatches_add_solids_patchesrF   
pcolormeshr   r   ry   r   rc   _yn_rasterizeset_rasterized_update_dividers)r%   r'  r(  Csolidr   s         r   r%  Colorbar._add_solids<  s     ;;"KK ((ELLN ) 4T2x!3!344Hx7G7GHHH$$Q17'',,aiidiitzz!6 - 3DK >>tww<4#3#33KK..t4r   c                 @   U R                   (       d  U R                  R                  / 5        g U R                  S:X  a@  U R                  R                  5       nUS   U R                  :  U R                  US   :  -  nO?U R                  R                  5       nUS   U R                  :  U R                  US   :  -  nU R                  U   nU R                  5       (       a  [        R                  " USUS   5      nU R                  5       (       a  [        R                  " X1S   5      n[        R                  " SS/U5      u  pEU R                  S:X  a  [        R                  " XE/5      nO[        R                  " XT/5      nU R                  R                  U5        g )NrR   r   rO   )r   r   set_segmentsrZ   rF   get_ylimr?  get_xlimrV   r   insertrW   appendmeshgriddstack)r%   limsboundsra   r'  r(  segmentss          r   rB  Colorbar._update_dividersR  sA   ~~MM&&r*z)77##%D1g'DGGd1g,=>F77##%D1g'DGGd1g,=>FGGFO		!QQ(A		!!W%A{{Aq61%z)yy!(Hyy!(H""8,r   c           
      f   UR                   [        U5      S-   -  nU R                  5       (       a  USS  n/ n[        [        U5      S-
  5       H  n[        R
                  " XS4   X'S4   /XS4   X'S4   /XS-   S4   X'S-   S4   /XS-   S4   X'S-   S4   //5      n[        R                  " [        R                  " U5      U R                  U R                  X7   S   5      5      XW   SSU R                  S9n	U R                  R                  U	5        UR                  U	5        M     X`l        g )NrO   r   F)	facecolorr1  	linewidthantialiasedry   )r<  rc   rV   ranger   arrayr!   	PathPatchr   r   r   r   ry   rF   	add_patchrK  r   )
r%   r'  r(  rC  r   r<  patchesir3   patchs
             r   r=  Colorbar._add_solids_patchesj  s2   ""c!fqj1abkGs1vz"AAdGQ!tW-dGQ!tW-!eQhKq5!85!eQhKq5!857 8B &&uzz"~15499QT!W;M1N-4Z138

LE GGe$NN5! # &r   c                 P
   U R                    H  nUR                  5         M     / U l         U R                  5       u  p4SU R                  5       (       a  US   OS-
  nSU R	                  5       (       a  US   OS-   nU R
                  (       d,  [        R                  " SS/SU/SS/SS/SU/SS/SS//5      nO1[        R                  " SS/SU/SU/SS/SS/SU/SU/SS/SS//	5      nU R                  S:X  a  USS2SSS24   nU R                  R                  U5        U R                  (       d  g[        U SS5      n[        U[        R                  5      (       aG  [!        S UR"                   5       5      (       a&  UR"                  [%        U R&                  5      S-   -  n	OS/[%        U R&                  5      S-   -  n	U R                  5       (       Ga  U R
                  (       d   [        R                  " SS/SU/SS//5      n
O"[        R                  " SS/SU/S	U/SS//5      n
U R                  S:X  a  U
SS2SSS24   n
U R(                  R+                  5       (       a  SOSnU R-                  U R/                  U R0                  U   5      5      n[2        R4                  " [6        R8                  " U
5      XR:                  SS
U R<                  R>                  U	S   S
[        R@                  " U R<                  RB                  RD                  [        RF                  * 5      S9	nU R<                  RI                  U5        U R                   RK                  U5        U	SS n	U R	                  5       (       Ga  U R
                  (       d   [        R                  " SS/SU/SS//5      n
O"[        R                  " SS/SU/SU/SS//5      n
U R                  S:X  a  U
SS2SSS24   n
U R(                  R+                  5       (       a  SOSnU R-                  U R/                  U R0                  U   5      5      n[%        U R&                  5      S-
  n[2        R4                  " [6        R8                  " U
5      XR:                  SS
U R<                  R>                  X   S
[        R@                  " U R<                  RB                  RD                  [        RF                  * 5      S9	nU R<                  RI                  U5        U R                   RK                  U5        U RM                  5         g)z
Add the extend tri/rectangles on the outside of the Axes.

ax is unused, but required due to the callbacks on xlim/ylim changed
r   rO   r   r   Nr   r   c              3   (   #    U  H  oS Lv   M
     g 7fr:   rk   r/  s     r   r2  'Colorbar._do_extends.<locals>.<genexpr>  r4  r5        ?F)rS  ry   rT  rU  	transformr1  r   zorder)'r   r:  rU   rV   rW   r|   r   rW  rZ   r   r4   r   rn   r   r   r   r;  r<  rc   r?  r   r  r   r   r$  r!   rX  r   r   ry   rF   r$   	nextafterr\  rc  infrY  rK  rB  )r%   rF   r\  r   rb   botr   xyoutr   r<  r3   valcolor	hatch_idxs                 r   r   Colorbar._do_extends}  sb    ))ELLN *! ++-4#5#5#7#79Q<Q?4#5#5#7#79Q<Q? HHq!fsCj1a& !fsCj1a&1a&B CE HHq!fq#hC1a& !fq#hC1a& !f& 'E |+!TrT'NE 	E"|| 4T2x!3!344Hx7G7GHHH&&#dgg,*:;GfDGGq 01G??XX1vSzAq6:; XX1v3x"cQFCD</4R4[3355"1CIIdiiS(9:;E&&

2%zz''++aj% ||DGGMM$8$8266'BDE GGe$  ''.abkG??XX1vSzAq6:; XX1v3x!SAq6BC</4R4[~~2244!"CIIdiiS(9:;EDGGq(I&&

2%zz''++73E ||DGGMM$8$8266'BDE GGe$  ''.r   c                    [         R                  " SS jSS j/U /UQ70 UD6nSU;   a  UR                  5       u  pn[        U[        R
                  5      (       a  UR                  (       a  [        S5      eU R                  UR                  UR                  UR                  UR                  5      UR                  5       US9$ UR                  5       u  ppxnU R                  U5      n	U R                  S   U R                  S   -
  S	-  n
XR                  S   U
-   :  XR                  S   U
-
  :  -  nX   n	[         R"                  " U5      (       a  [         R$                  " U5      U   n[         R"                  " U5      (       a  [         R$                  " U5      U   n[         R&                  " SS
/U	5      u  pU R(                  S:X  a  [         R*                  " X/SS9nO[         R*                  " X/SS9n[,        R.                  " XUS9nU(       a;  U R0                  (       a*  U R0                   H  nUR3                  5         M     / U l        U R0                  R5                  U5        [         R6                  " U5      S-  n[         R8                  " SS/S
S/S
S
/SS
/SS//5      nU R:                  R=                  5       R>                  nURA                  5       RC                  U R:                  RD                  RC                  U5      5      nU/ SQS
4==   U-  ss'   USS/S
4==   U-  ss'   U R:                  RD                  RA                  5       RC                  URC                  U5      5      nURG                  [H        RJ                  " USS9U R:                  RD                  5        U R:                  RM                  U5        SU l'        g)a  
Draw lines on the colorbar.

The lines are appended to the list :attr:`lines`.

Parameters
----------
levels : array-like
    The positions of the lines.
colors : :mpltype:`color` or list of :mpltype:`color`
    Either a single color applying to all lines or one color value for
    each line.
linewidths : float or array-like
    Either a single linewidth applying to all lines or one linewidth
    for each line.
erase : bool, default: True
    Whether to remove any previously added lines.

Notes
-----
Alternatively, this method can also be called with the signature
``colorbar.add_lines(contour_set, erase=True)``, in which case
*levels*, *colors*, and *linewidths* are taken from *contour_set*.
Tc                     [        5       $ r:   locals)r%   r  erases      r   rl   $Colorbar.add_lines.<locals>.<lambda>  s    &(r   c                     [        5       $ r:   rn  )r%   r   r   r   rp  s        r   rl   rq    s    &(r   r  zKIf a single artist is passed to add_lines, it must be a ContourSet of lines)rp  r   r   g|=rO   rR   )axis)r   r   H   )r   rO      r      r.   N)T)(r   select_matching_signaturer   r   r   r   r   r   r   r   to_rgbar   ry   get_linewidths_locater?  r   r   asarrayrL  rZ   stackr   r   r   r:  rK  r   rW  rF   
get_figuredpi_scale_transinvertedrb  r$   set_clip_pathr   r   r   r2   )r%   r   r   paramsr   rp  r   r   r   ra   rtoligoodr'  r(  r3   collcfacinchess                      r   r   Colorbar.add_lines  s.   2 //2JL# # "# 6>$mmoODeb'"4"455  "D E E >>		

2::rxx0!!#	 "   7=mmo3D&eLL dggaj(E1WWR[4''A
T0A,ABH;;vZZ'.F;;z""J/6J{{Aq61%z)1&r*B1&r*B((068 TZZjj		 !DJ

# ffZ 2%XX1v1v1v1v1v>?##%55__(():):)D)DR)HI
9a<C
Aq619WW'')33F4D4DR4HI%**R5''++	-s#
r   c                    U R                  5         U R                  R                  U R                  5        U R                  R	                  U R
                  5        U R                  R                  U R                  5        g)zF
Set up the ticks and ticklabels. This should not be needed by users.
N)_get_ticker_locator_formatterr   r   r   r   r   r   r   ro   s    r   r"  Colorbar.update_ticks+  sT    
 	**,((7((););<**4??;r   c                    U R                   nU R                  nU R                  n[        U R                  [
        R                  5      (       aH  U R                  R                  nUc  [        R                  " USS9nUc  [        R                  " U5      nO[        U R                  [
        R                  5      (       a?  Uc;  [        U R                  5      nS[        US-  5      -   n[        R                  " USS9nOyU R                  b2  U R                  U R                      nUc  [        R                  " USS9nO:Uc  U R"                  R%                  5       nUc  U R"                  R'                  5       nUc  [        R(                  " 5       nUc  U R"                  R+                  5       nXl         X l        X0l        [,        R/                  SU5        g)z
Return the ``locator`` and ``formatter`` of the colorbar.

If they have not been defined (i.e. are *None*), the formatter and
locator are retrieved from the axis, or from the value of the
boundaries for a boundary norm.

Called by update_ticks...
Nr   r   rO   r   )basere   zlocator: %r)r   r   r   r   r   r   r   r   r	   r   r   rc   r$  intIndexLocatorr  r   r   r   r   NullLocatorr   r  r  )r%   r   r   r   bnvr  s          r   r  &Colorbar._get_ticker_locator_formatter5  ss    --OO	))dii!4!455		$$A --ar:#%2215		6==11&3rBw<' --4C__(  .A --ar: ..::<##~~??A!--/L::<I#)

='*r   labelsr  c                   [         R                  " U5      (       a?  U R                  R                  " U4X#S.UD6  U R                  R	                  5       U l        O+Xl        U R                  R                  U R
                  5        SU l        g)a  
Set tick locations.

Parameters
----------
ticks : 1D array-like
    List of tick locations.
labels : list of str, optional
    List of tick labels. If not set, the labels show the data value.
minor : bool, default: False
    If ``False``, set the major ticks; if ``True``, the minor ticks.
**kwargs
    `.Text` properties for the labels. These take effect only if you
    pass *labels*. In other cases, please use `~.Axes.tick_params`.
r  TN)r   r   r   r  r   r   r   r2   )r%   r}   r  r  r   s        r   r  Colorbar.set_tickse  sl      ;;uNN$$U 26 2*02 NN<<>DM!MNN,,T]];
r   c                 x    U(       a  U R                   R                  5       $ U R                   R                  5       $ )z
Return the ticks as a list of locations.

Parameters
----------
minor : boolean, default: False
    if True return the minor ticks.
)r   get_minorticklocsget_majorticklocs)r%   r  s     r   	get_ticksColorbar.get_ticks~  s-     >>3355>>3355r   r  c                B    U R                   R                  " U4SU0UD6  g)a  
[*Discouraged*] Set tick labels.

.. admonition:: Discouraged

    The use of this method is discouraged, because of the dependency
    on tick positions. In most cases, you'll want to use
    ``set_ticks(positions, labels=labels)`` instead.

    If you are using this method, you should always fix the tick
    positions before, e.g. by using `.Colorbar.set_ticks` or by
    explicitly setting a `~.ticker.FixedLocator` on the long axis
    of the colorbar. Otherwise, ticks are free to move and the
    labels may end up in unexpected positions.

Parameters
----------
ticklabels : sequence of str or of `.Text`
    Texts for labeling each tick location in the sequence set by
    `.Colorbar.set_ticks`; the number of labels must match the number
    of locations.

update_ticks : bool, default: True
    This keyword argument is ignored and will be removed.
    Deprecated

minor : bool
    If True, set minor ticks instead of major ticks.

**kwargs
    `.Text` properties for the labels.
r  N)r   set_ticklabels)r%   
ticklabelsr  r   s       r   r  Colorbar.set_ticklabels  s!    B 	%%jHHHr   c                     U R                   R                  5         U R                  5       R                  [        R
                  " 5       5        g)z
Turn on colorbar minor ticks.
N)rF   r  r  r   r	   r  ro   s    r   r  Colorbar.minorticks_on  s4     	,,V-?-?-ABr   c                     [         R                  " 5       U l        U R                  R	                  U R                  5        g)z)Turn the minor ticks of the colorbar off.N)r	   r  r   r   r   ro   s    r   minorticks_offColorbar.minorticks_off  s+    #//1((););<r   )r   c                    U R                   S:X  a   U R                  R                  " U4SU0UD6  OU R                  R                  " U4SU0UD6  SU l        g)a$  
Add a label to the long axis of the colorbar.

Parameters
----------
label : str
    The label text.
loc : str, optional
    The location of the label.

    - For horizontal orientation one of {'left', 'center', 'right'}
    - For vertical orientation one of {'bottom', 'center', 'top'}

    Defaults to :rc:`xaxis.labellocation` or :rc:`yaxis.labellocation`
    depending on the orientation.
**kwargs
    Keyword arguments are passed to `~.Axes.set_xlabel` /
    `~.Axes.set_ylabel`.
    Supported keywords are *labelpad* and `.Text` properties.
rR   r   TN)rZ   rF   
set_ylabel
set_xlabelr2   )r%   r   r   r   s       r   r   Colorbar.set_label  sQ    * z)GGu8#88GGu8#88
r   c                 `    [        U[        R                  5      (       a  SU l        gUU l        g)z
Set the transparency between 0 (transparent) and 1 (opaque).

If an array is provided, *alpha* will be set to None to use the
transparency values associated with the colormap.
N)r   r   ndarrayry   )r%   ry   s     r   r   Colorbar.set_alpha  s!     (rzz::T

r   c                 >    U R                   R                  " U40 UD6  g)a  
Set the colorbar long axis scale.

Parameters
----------
scale : {"linear", "log", "symlog", "logit", ...} or `.ScaleBase`
    The axis scale type to apply.

**kwargs
    Different keyword arguments are accepted, depending on the scale.
    See the respective class keyword arguments:

    - `matplotlib.scale.LinearScale`
    - `matplotlib.scale.LogScale`
    - `matplotlib.scale.SymmetricalLogScale`
    - `matplotlib.scale.LogitScale`
    - `matplotlib.scale.FuncScale`
    - `matplotlib.scale.AsinhScale`

Notes
-----
By default, Matplotlib supports the above-mentioned scales.
Additionally, custom scales may be registered using
`matplotlib.scale.register_scale`. These scales can then also
be used here.
N)r   _set_axes_scale)r%   scaler   s      r   
_set_scaleColorbar._set_scale  s    6 	&&u77r   c                    [        U R                  S5      (       ac  U R                  R                  S   nU HD  nU R                  UR                  ;   d  M  UR                  R	                  U R                  5        MF     U R                  R	                  5         U R
                  R                  R                  U R
                  R                  5        SU R
                  l	        SU R
                  l        U R                  R                  R                  U R                  5        U R                  R                  R                  U R                  5         U R
                  R                  n U R                  R                  5       R                  5       R                   nUR#                  U5        g! [         a     gf = f! [         a#    UR%                  SS9nUR'                  U5         gf = f)z
Remove this colorbar from the figure.

If the colorbar was created with ``use_gridspec=True`` the previous
gridspec is restored.
rP   parentsNTrL   )rY   rF   rP   
_colorbarsr:  r   r   
disconnectr   r   r   r   r&   AttributeErrorri   get_gridspec_subplot_specset_subplotspecrS   _set_position)r%   r  arF   subplotspecr`   s         r   r:  Colorbar.remove  sl    477,--gg,,Y7G77all*LL''0  	**4==+E+EF!%%)"$$T%6%67$$T%6%67	##B	,''113@@BPPK
 {+  		  	"//4/0CS!	"s$   F. *2F> .
F;:F;>*G+*G+c                    U R                   b  [        R                  " U R                   5      U l        U R                  cz  [        R
                  " [        U R                   5      S-   5      nSU R                  SS U R                  SS -   -  USS& SUS   -  US   -
  US'   SUS   -  US	   -
  US'   Xl        g[        R                  " U R                  5      U l        g[        U R                  [        R                  5      (       a  U R                  R                  nO[        U R                  [        R                  5      (       a1  [        R                  " U R                  R                  S-   5      S-
  nOFU R                  b  U R                  nO,U R                  R                  S-   nU R!                  U5      u  pU R#                  5       (       a  [        R$                  " US   S-
  U45      nU R'                  5       (       a  [        R$                  " XS   S-   45      nU R(                  R+                  5       b  U R(                  R-                  5         U R                  R/                  5       (       d"  SU R                  l        SU R                  l        [4        R6                  " U R                  R0                  U R                  R2                  S
S9u  U R                  l        U R                  l        [        U R                  [        R                  5      (       d(  U R                  c  U R                  R9                  U5      n[        R:                  " U[<        S9U l        SU R                  SS U R                  SS -   -  U l        [        U R                  [        R                  5      (       a2  U R                  S-   R?                  [        R@                  5      U l        gg)z
Set `_boundaries` and `_values` based on the self.boundaries and
self.values if not None, or based on the size of the colormap and
the vmin/vmax of the norm.
NrO   r   r   g       @r   r   皙?)expander)dtypegh㈵>)!r   r   rW  r$  r   zerosrc   r  r   r   r   r   r   r#  r   N
_uniform_yrV   hstackrW   r   	get_arrayautoscale_Nonescaledr  r  mtransformsnonsingularinverser{  floatastypeint16)r%   r  r  r   s       r   r  Colorbar._process_values  s    ;;"88DKK0DL&HHS-12cr!2T\\!"5E!EF!BQqTzAaD(!aeae+"#$ !xx8D dii!4!455		$$A		6==11		$))++/*R/A__(A 		aA??1%DA		1Q4!8Q-(A		1eai.)A ==""$0MM((*yy!!DIINDIIN)4)@)@IINNDIINNS*:&				499f&9&9::(		!!!$A::au5d..s3d6F6Fqr6JJKdii// LL72::288DDL 0r   c                    U R                  5       u  p[        U R                  [        R                  [        R
                  45      (       d  U R                  b)  XR                  U R                  -
  -  U R                  -   nOU R                  R                  R                  5          [        R                  " U R                  U R                  U R                  S9   U R                  R                  U5      nSSS5        SSS5        Xl        [        R                   " SS/U5      u  p4U R"                  S:X  a  X44$ XC4$ ! , (       d  f       NM= f! , (       d  f       NV= f)z
Return the coordinate arrays for the colorbar pcolormesh/patches.

These are scaled between vmin and vmax, and already handle colorbar
orientation.
N)r  r          ra  rR   )rU   r   r   r   r   r   r   r  r  r   blockedr   _setattr_cmr  r?  r   rL  rZ   )r%   ra   r   r'  r(  s        r   r  Colorbar._meshV  s     ##%
 tyy6#6#6"FGG??.YY*+dii7A
 ))%%--/##DIIDIIDIINII%%a( O 0 {{B8Q'z)6M6M ON 0/s$   &5ED>7E>
E	E
Ec                     U R                   n[        R                  " X[        R                  " SS[	        U5      5      5      nUS   US   -
  S-  nSX1US   U-
  :  '   SX1US   U-   :  '   U$ )Nr   rO   r   gư>r   r  r   interplinspacerc   )r%   r   r  ra   epss        r   _forward_boundariesColorbar._forward_boundariest  sr    IIaBKK1c!f56uqt|t# ad3h,aeCi-r   c           
          U R                   n[        R                  " U[        R                  " SS[	        U5      5      U5      $ )Nr   rO   r  )r%   r   r  s      r   _inverse_boundariesColorbar._inverse_boundaries  s1    yyBKK1c!f5q99r   c                    U R                  5         SU l        SU l        SU l        SU l        [        U R                  [        R                  5      (       a;  [        U R                  [        R                  5      (       a  U R                  S5        gU R                  c)  [        U R                  [        R                  5      (       a\  U R                  S:X  a)  U R                   U R"                  4nU R                  SUS9  gU R                  S:X  a  U R                  S5        gg[%        U R                  SS5      (       a&  U R                  U R                  R&                  5        g[)        U R                  5      [        R*                  L a  U R                  S5        gU R                  U R                  R,                  4nU R                  SUS9  g)	z
Reset the locator et al to defaults.  Any user-hardcoded changes
need to be re-entered if this gets called (either at init, or when
the mappable normal gets changed: Colorbar.update_normal)
Nlogrv   function)	functionsr   linear_scale)r  r   r   r   r   r   r   r   r   r   r   LogNormr  r   r   r   r  r  rn   r  type	Normalizer  )r%   funcss     r   r   'Colorbar._reset_locator_formatter_scale  sK    	!#t}}g&8&899499fnn55OOE"oo)499f&9&9::||y(1143K3KL
e</) 0TYY$//OODII,,-$))_ 0 00OOH% YY		 1 12EOOJ%O8r   c                    [        U R                  [        R                  [        R                  45      (       a  U R
                  nUnOFU R                  U R
                  SS9R                  5       nU R                  USS9R                  5       nX R                     nU R                  n[        R                  " X4U5      nU$ )zY
Given a set of color data values, return their
corresponding colorbar data coordinates.
F)clip)r   r   r   r   r   r  r   r   r?  r   r  )r%   r   r  xnbuniqueyuniquezs          r   rz  Colorbar._locate  s    
 dii&--1D1D!EFF  AB 		$**	7>>@A15)002BLL/''IIb7+r   c                     SUS-
  -  =p#U R                  U R                  X#SS9n[        R                  " SSU5      nXT4$ )zk
Return colorbar data coordinates for *N* uniformly
spaced boundaries, plus extension lengths if required.
ra  皙?defaultr   rO   )_get_extension_lengthsr{   r   r  )r%   r  autominautomaxextendlengthra   s         r   r  Colorbar._uniform_y  sR    
 !b&M)224??3:;? 3 A KK1a r   c                    [        U R                  [        R                  5      (       d  U R                  b  U R
                  U R
                  U R                     S   -
  nXR
                  U R                     S   U R
                  U R                     S   -
  -  nU R                  S:X  a  U R                  U R
                  5      nO\UnOYU R                  U R
                  R                  5       5      n[        R                  R                  U[        R                  5      nUnXR                     nX R                     n[        R                  " US   US   5      n[        R                  R                  U" U5      [        R                  5      n[        R                  " US   US   5      n[        R                  R                  U" U5      [        R                  5      nUS   US   -
  nUS   US   -
  nSS/nU R                  5       (       d  U R!                  5       (       a  U R#                  U R$                  XESS9nX4$ )zu
Return colorbar data coordinates for the boundaries of
a proportional colorbar, plus extension lengths if required:
r   r   rv   rO   r  r  r  )r   r   r   r   r   r  r   r   r  copyr   mar   nanr  rV   rW   r  r{   )r%   ra   yscaledr   r  r  r  s          r   rU   Colorbar._proportional_y  s   
 tyy&"5"566+!!D$4$4T\\$B1$EEA%%dll3B7%%dll3A67 8A ||y(2243C3CD		$**//12AQ'AGllO,,'!ae,EELLa"&&)
GBK8%%,,tG}bff5 !*wqz)"++1v4#5#5#7#766OOWt 7 ELr   c                 z   [         R                  " XD/5      n[        U[        5      (       a,  [        R
                  " S/UR                  5       S9  X#/USS& U$ Ub;   XSS& [         R                  " U5      R                  5       (       a
  [        5       e U$ U$ ! [        [        4 a  n[        S5      UeSnAff = f)zi
Return the lengths of colorbar extensions.

This is a helper method for _uniform_y and _proportional_y.
rx   )r{   Nzinvalid value for extendfrac)r   rW  r   r   r   r   r)  isnanr;  r   r   )r%   fracr  r  r  r  errs          r   r  Colorbar._get_extension_lengths  s     xx 23dC  xDJJLA&0LO  	J"&Q 88L)--//$,& 0
 | z* J !?@cIJs   7B B:)B55B:c                 j    U R                   R                  5       (       a  SOSnU R                  SU4;   $ )z-Return whether the lower limit is open ended.r   r   r   r   r  rT   r%   minmaxs     r   rV   Colorbar._extend_lower  /    ..5577U{{vv...r   c                 j    U R                   R                  5       (       a  SOSnU R                  SU4;   $ )z-Return whether the upper limit is open ended.r   r   r   r  r	  s     r   rW   Colorbar._extend_upper  r  r   c                 z    U R                   S:X  a  U R                  R                  $ U R                  R                  $ )zReturn the short axisrR   )rZ   rF   r   r   ro   s    r   r  Colorbar._short_axis  s,    z)77== ww}}r   c                 Z    U R                   R                  U R                   R                  4$ r:   r   r  r  ro   s    r   r   Colorbar._get_view  s     yy~~tyy~~--r   c                 J    Uu  U R                   l        U R                   l        g r:   r  )r%   views     r   r   Colorbar._set_view  s     *.&				r   c                    U R                   R                  XX4US9u  pgU R                  S:X  a$  Uu  U R                  l        U R                  l        g U R                  S:X  a$  Uu  U R                  l        U R                  l        g g )N)	directionmodetwinxtwinyr   rR   )rF   _prepare_view_from_bboxrZ   r   r  r  )r%   bboxr  r  r  r  
new_xbound
new_ybounds           r   r   Colorbar._set_view_from_bbox"  sv     "&!@!@DU "A "L
|+-7*DIINDIIN+-7*DIINDIIN ,r   c                 0   U R                   R                  XX45      nUbw  U R                  S:X  a+  US S 2S4   u  U R                  l        U R                  l        g U R                  S:X  a+  US S 2S4   u  U R                  l        U R                  l        g g g )Nr   r   rR   rO   )rF   _get_pan_pointsrZ   r   r  r  )r%   buttonkeyr   ra   pointss         r   r   Colorbar.drag_pan-  s    ((a;</171.				!!Z/171.				 0 r   )#r  r   r   r   r   r   r   r   r   r   r   r$  r?  ry   rF   r   r   r   r   rT   r{   r|   r   r   r   rZ   r   r   r   r   r2   r   r   r  r  r:   )F)r  )inNFF)2r;   r<   r=   r>   rq   r@  r   propertyr   r   setterr   r   r  r   r   r   r%  rB  r=  r   r   r"  r  r  r  r  r  r  r   r   r  r:  r  r  r  r  r   rz  r  rU   r  rV   rW   r  r   r   r   r   r?   rk   r   r   rs   rs      s   0 K  J.vJ.X   2 2 ^^  2 2 ! ! 4 4   4 4 # ##J2Bh ,-0&&\ |N`<.+` *.U 26 38 !IFC=
 '+ 6F8: ,D6Ep<
:
 9D,
$L2/
/
.
.
 37:?	8>r   rs   c           
          U c  [        U5      n [        R                  " SSSSS.SSSSS.SS	S
SS.SS
S	SS.S.U S9n[        U 5      US'   Ub  XS   :w  a  [	        S5      eU$ )Nr   )ra  r   )r  r   r  )rz   anchorpanchorpadr   r  r   )r   r  )r   ra  r   333333?)r   r   r   r   rz   rZ   r   )r   r   r   r   r   )rz   rZ   loc_settingss      r   _normalize_location_orientationr1  :  s    5kB%%%(7&*(7$
(7':(7	' 	L #A"JL;}2M#MIJJr   c                 8    [         R                  " S SSSSS.U S9$ )NrR   r   )Nr   r   r   r   r/  r   r   r/  s    r   r   r   N  s+    Z*	6@HJ Jr   c                 4    [         R                  " SSSS.U S9$ )Nr   r   r   r   r3  r   s    r   r   r   T  s"    G8D! !r   r.  ra     c                 H  ^ [        X5      nUS   US'   US   =oS'   UR                  SUS   5      nUR                  SUS   5      n	Un
[        U [        R                  5      (       a  [        U R                  5      n O*[        R                  " U 5      (       a  [        U 5      n OU /n U S   R                  5       mTR                  5       (       a  SOUS   nUR                  SU5      n[        U4S	 jU  5       5      (       d  [        S
5      e[        R                  R                  U  Vs/ s H  oR                  SS9R!                  5       PM!     sn5      nUnUS;   aa  US:X  a  UR#                  X3U-   5      u  nnnOUR#                  SU-
  U-
  SU-
  5      u  nnnUR%                  SU5      R'                  UU5      nOeUS:X  a  UR)                  X3U-   5      u  nnnOUR)                  SU-
  U-
  SU-
  5      u  nnnUR%                  US5      R'                  UU5      nSU-  n[        R*                  " UU5      nU  H`  nUR-                  UR                  SS95      n[        R                  " U5      nUR/                  U5        U	SLd  MO  UR1                  U	5        Mb     TR3                  USS9nU  H  nU=R4                  U/-  sl        M     [7        U UUUU	UU
US9Ul        UR1                  U5        UR;                  U5        UR=                  S5        UU4$ s  snf )a  
Create an `~.axes.Axes` suitable for a colorbar.

The Axes is placed in the figure of the *parents* Axes, by resizing and
repositioning *parents*.

Parameters
----------
parents : `~matplotlib.axes.Axes` or iterable or `numpy.ndarray` of `~.axes.Axes`
    The Axes to use as parents for placing the colorbar.
%(_make_axes_kw_doc)s

Returns
-------
cax : `~matplotlib.axes.Axes`
    The child Axes.
kwargs : dict
    The reduced keyword dictionary to be passed when creating the colorbar
    instance.
rZ   rz   r   r+  r,  r   r  r-  c              3   H   >#    U  H  nTUR                  5       L v   M     g 7fr:   )r}  )r0  rF   figs     r   r2  make_axes.<locals>.<genexpr>  s     8"sbmmo%s   "zJUnable to create a colorbar Axes as not all parents share the same figure.TrL   r   r   r   rO   ra  r   F
<colorbar>r   )r  rz   rd   r+  r,  fractionrQ   r-  rx   )r1  popr   r   r  listr7  r   r}  get_constrained_layoutallr   r  BboxunionrS   frozensplitxr\   anchoredsplityBboxTransformrb  r  
set_anchoradd_axesr  dictrP   r[   
set_aspect)r  rz   rZ   r=  rd   rQ   r   r0  r+  r,  aspect0pad0r-  rF   parents_bboxpbpbcbr   pb1shrinking_transnew_posncaxr  r8  s                          @r   	make_axesrV  Z  s   . 38IL )7F=(4Z(@@Hn%ZZ,x"89FjjL$;<GG '2::&&w||$	W		w-)
!*


!C--//4\%5HD
**UD
!C8888 : ; 	; ##));BC7R$	'	.	.	07CEL 
B$$v99X#~>LD!S99Q\C%7XFLCD{{3'00>x99X#~>LD!S99Q\C%7XFLCD{{63'00> v "//cBO ",,R__d_-KL##H-
"%MM'"  ,,t<,
0C	  C NN6vNN6;c 	Ds   ,&L)rz   rZ   r=  rd   rQ   c                H   [        X5      nUS   US'   US   =oS'   UnUR                  SUS   5      n	UR                  SUS   5      n
UR                  SUS   5      nSU-  SU-
  -  nUS	;   a  U R                  5       R                  S
SUSSU	S   -
  SU-
  -  XIS   SU-
  -  /S9nUS:X  a(  UR	                  USU-
  U-
  /5        USS2S4   nUS   nOUR	                  SU-
  U-
  U/5        USS2S4   nUS   nOU R                  5       R                  SS
USU	S   SU-
  -  USU	S   -
  SU-
  -  /S9nUS:X  a(  UR                  USU-
  U-
  /5        USSS24   nUS   nO'UR                  SU-
  U-
  U/5        USSS24   nUS   nSU-  nU R                  U5        U
SLa  U R                  U
5        U R                  5       nUR                  USS9nUR                  U	5        UR                  U5        UR                  S5        [        UU /UU	U
UUUS9Ul        UU4$ )aU  
Create an `~.axes.Axes` suitable for a colorbar.

The Axes is placed in the figure of the *parent* Axes, by resizing and
repositioning *parent*.

This function is similar to `.make_axes` and mostly compatible with it.
Primary differences are

- `.make_axes_gridspec` requires the *parent* to have a subplotspec.
- `.make_axes` positions the Axes in figure coordinates;
  `.make_axes_gridspec` positions it using a subplotspec.
- `.make_axes` updates the position of the parent.  `.make_axes_gridspec`
  replaces the parent gridspec with a new one.

Parameters
----------
parent : `~matplotlib.axes.Axes`
    The Axes to use as parent for placing the colorbar.
%(_make_axes_kw_doc)s

Returns
-------
cax : `~matplotlib.axes.Axes`
    The child Axes.
kwargs : dict
    The reduced keyword dictionary to be passed when creating the colorbar
    instance.
rZ   rz   r   r+  r,  r-  r   rO   r:  rv  r   )wspacehspaceheight_ratiosr   N)rO   r   )rO   rO   )rY  rX  width_ratiosr   )r   rO   Fr;  r<  rx   )rz   r  rd   r+  r,  r=  rQ   r-  )r1  r>  ri   subgridspecset_width_ratiosset_height_ratiosr  rI  r}  add_subplotr[   rL  rK  rP   )parentrz   rZ   r=  rd   rQ   r   r0  rM  r+  r,  r-  wh_spacegsss_mainss_cbr8  rU  s                     r   make_axes_gridspecre    s   B 38IL(7F=(4Z(@@Hn%GZZ,x"89FjjL$;<G
**UL/
0C3w!c'"H$$##%11q!fQiK!F(3VAY&=QR 2 T v1x<#+= >?AhGtHEX!3X >?AhGtHE##%11q! )QvX.6!9qx8PQ 2 S u  (AL3,>!?@AhGtHE  !h,"4h!?@AhGtHEV
7#e'"



C
//%|/
4CNN6vNN6C ;r   )NNr.  ra  r5  )-rq   loggingnumpyr   
matplotlibr   r   r   r   r   r   r   r	   matplotlib.artistartistr   matplotlib.patchesrZ  r!   matplotlib.pathpathr   matplotlib.spinesr   mspinesmatplotlib.transforms
transformsr  r
   	getLoggerr;   r  interpdregisterr   Spiner   rB   rs   ColorbarBaser1  r   r   rV  re  rk   r   r   <module>rw     s      L L L # %  # + !" 
    !ED3G  VrGW]] ..O .Ob o> o> o>d# (J! AE!#e eP +/T $SW Wr   