
    h~                     p   S r SSKJr  SSKrSSKrSSK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  SSKJr  SS	KJrJrJrJr  S
SKJ r    " S S5      r! " S S\!\5      r" " S S\RF                  5      r$ " S S\!\$5      r% " S S\%5      r& " S S\5      r' " S S\RP                  5      r)g)aG
  
The :mod:`.axis_artist` module implements custom artists to draw axis elements
(axis lines and labels, tick lines and labels, grid lines).

Axis lines and labels and tick lines and labels are managed by the `AxisArtist`
class; grid lines are managed by the `GridlinesCollection` class.

There is one `AxisArtist` per Axis; it can be accessed through
the ``axis`` dictionary of the parent Axes (which should be a
`mpl_toolkits.axislines.Axes`), e.g. ``ax.axis["bottom"]``.

Children of the AxisArtist are accessed as attributes: ``.line`` and ``.label``
for the axis line and label, ``.major_ticks``, ``.major_ticklabels``,
``.minor_ticks``, ``.minor_ticklabels`` for the tick lines and labels (e.g.
``ax.axis["bottom"].line``).

Children properties (colors, fonts, line widths, etc.) can be set using
setters, e.g. ::

  # Make the major ticks of the bottom axis red.
  ax.axis["bottom"].major_ticks.set_color("red")

However, things like the locations of ticks, and their ticklabels need to be
changed from the side of the grid_helper.

axis_direction
--------------

`AxisArtist`, `AxisLabel`, `TickLabels` have an *axis_direction* attribute,
which adjusts the location, angle, etc. The *axis_direction* must be one of
"left", "right", "bottom", "top", and follows the Matplotlib convention for
rectangular axis.

For example, for the *bottom* axis (the left and right is relative to the
direction of the increasing coordinate),

* ticklabels and axislabel are on the right
* ticklabels and axislabel have text angle of 0
* ticklabels are baseline, center-aligned
* axislabel is top, center-aligned

The text angles are actually relative to (90 + angle of the direction to the
ticklabel), which gives 0 for bottom axis.

=================== ====== ======== ====== ========
Property            left   bottom   right  top
=================== ====== ======== ====== ========
ticklabel location  left   right    right  left
axislabel location  left   right    right  left
ticklabel angle     90     0        -90    180
axislabel angle     180    0        0      180
ticklabel va        center baseline center baseline
axislabel va        center top      center bottom
ticklabel ha        right  center   right  center
axislabel ha        right  center   right  center
=================== ====== ======== ====== ========

Ticks are by default direct opposite side of the ticklabels. To make ticks to
the same side of the ticklabels, ::

  ax.axis["bottom"].major_ticks.set_tick_out(True)

The following attributes can be customized (use the ``set_xxx`` methods):

* `Ticks`: ticksize, tick_out
* `TickLabels`: pad
* `AxisLabel`: pad
    )methodcallerN)_apicbook)LineCollection)Line2D)	PathPatch)Path)Affine2DBboxIdentityTransformScaledTranslation   )AxislineStylec                   .   ^  \ rS rSrS rU 4S jrSrU =r$ )AttributeCopier]   c                     [        S5      e)zb
Return the underlying artist that actually defines some properties
(e.g., color) of this artist.
zget_ref_artist must overridden)RuntimeErrorselfs    U/var/www/html/env/lib/python3.13/site-packages/mpl_toolkits/axisartist/axis_artist.pyget_ref_artistAttributeCopier.get_ref_artist^   s    
 ;<<    c                 |   > [        SU-   5      nU" [        5       5      nUS:X  a  U" U R                  5       5      $ U$ )Nget_auto)r   superr   )r   	attr_namegetterprop	__class__s       r   get_attribute_from_ref_artist-AttributeCopier.get_attribute_from_ref_artiste   s<    fy01eg04vd))+,HDHr    )__name__
__module____qualname____firstlineno__r   r#   __static_attributes____classcell__r"   s   @r   r   r   ]   s    =I Ir   r   c                       \ rS rSrSr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S/SS//5      rS rSrg)Ticksk   a;  
Ticks are derived from `.Line2D`, and note that ticks themselves
are markers. Thus, you should use set_mec, set_mew, etc.

To change the tick size (length), you need to use
`set_ticksize`. To change the direction of the ticks (ticks are
in opposite direction of ticklabels by default), use
``set_tick_out(False)``
N)axisc                    Xl         / U l        U R                  U5        X0l        U R                  b  SU;  a  SUS'   SU;  a  SU;  a  SUS'   [        R
                  " U S/S/40 UD6  U R                  S5        g )Ncolorr   mewmarkeredgewidth        T)	_ticksizelocs_angles_labelsset_tick_out_axisr   __init__set_snap)r   ticksizetick_outr0   kwargss        r   r:   Ticks.__init__v   s}    !"$(#
::!f$"(wF"'8'F,2()rdRD3F3dr   c                 H    U R                   R                  S   R                  $ Nr   )r9   
majorTicks	tick1liner   s    r   r   Ticks.get_ref_artist   s    zz$$Q'111r   c                 ~    [         R                  " US5      (       d  [        R                  " US9  Xl        SU l        g )Nr   )r2   T)r   
_str_equalmcolors_check_color_like_colorstale)r   r2   s     r   	set_colorTicks.set_color   s1     v..%%E2
r   c                 $    U R                  S5      $ Nr2   r#   r   s    r   	get_colorTicks.get_color       11'::r   c                 $    U R                  S5      $ )NmarkeredgecolorrO   r   s    r   get_markeredgecolorTicks.get_markeredgecolor       112CDDr   c                 $    U R                  S5      $ )Nr4   rO   r   s    r   get_markeredgewidthTicks.get_markeredgewidth   rW   r   c                     Xl         g)z7Set whether ticks are drawn inside or outside the axes.N	_tick_out)r   bs     r   r8   Ticks.set_tick_out   s    r   c                     U R                   $ )z:Return whether ticks are drawn inside or outside the axes.r\   r   s    r   get_tick_outTicks.get_tick_out       ~~r   c                     Xl         g)z"Set length of the ticks in points.Nr6   )r   r<   s     r   set_ticksizeTicks.set_ticksize   s    !r   c                     U R                   $ )z%Return length of the ticks in points.re   r   s    r   get_ticksizeTicks.get_ticksize   rc   r   c                     Xl         g N)locs_angles)r   rm   s     r   set_locs_anglesTicks.set_locs_angles   s    &r   r5         ?c           	         U R                  5       (       d  g UR                  5       nUR                  U R                  5       5        UR	                  U R                  5       5        UR                  U R                  5        U R                  5       n[        5       R                  UR                  U R                  5      5      nU R                  5       (       a  UR                  S5        U R                   H  u  pVUR!                  ["        R$                  " U/5      5      nU R&                  (       a-  U R&                  R(                  R*                  " US   6 (       d  Mi  UR-                  X R.                  U[        5       R                  U5      -   [1        U5      UR3                  5       5        M     UR5                  5         g )N   r   )get_visiblenew_gcset_foregroundrU   set_linewidthrY   	set_alpha_alphaget_transformr
   scalepoints_to_pixelsr6   ra   
rotate_degrm   transform_non_affinenparrayaxesviewLimcontainsdraw_markers_tickvert_pathr	   
get_affinerestore)r   renderergc
path_transmarker_transformlocanglelocss           r   draw
Ticks.draw   sF   !!__
$2245
1134
T[[!'')
$J"U8#<#<T^^#LM 	'',**JC22288SE?CDyy!2!2!;!;T!W!E!!'' 8:#8#8#??T
J1135	 + 	

r   )r9   rI   r]   r6   rm   r7   rJ   )F)r&   r'   r(   r)   __doc__r:   r   rK   rP   rU   rY   r8   ra   rf   ri   rn   r	   r   r   r*   r%   r   r   r.   r.   k   se      2;EE"' B8b"X./Nr   r.   c                      ^  \ rS rSrSrU 4S jr\S 5       r\S 5       rSSSS	S
.R                  r
U 4S jrSU 4S jjrSrU =r$ )	LabelBase   z
A base class for `.AxisLabel` and `.TickLabels`. The position and
angle of the text are calculated by the offset_ref_angle,
text_ref_angle, and offset_radius attributes.
c                    > / U l         SU l        SU l        [        TU ]  " U0 UD6  U R                  S5        SU l        g )Nr   r5   anchorT)r7   
_ref_angle_offset_radiusr   r:   set_rotation_mode_text_follow_ref_angle)r   argsr>   r"   s      r   r:   LabelBase.__init__   sB    "$ $)&)x(&*#r   c                 D    U R                   (       a  U R                  S-   $ g)NZ   r   )r   r   r   s    r   _text_ref_angleLabelBase._text_ref_angle   s    &&??R''r   c                     U R                   $ rl   )r   r   s    r   _offset_ref_angleLabelBase._offset_ref_angle   s    r   rightleftbottomtop)r   r   r   r   c                    > U R                  5       (       d  g U R                  5       nU R                  5       n[        R                  " U R
                  5      nU R                  nU[        R                  " U5      -  U[        R                  " U5      -  pvU R                  U[        5       R                  Xg5      -   5        U R                  U R                  U-   5        [        TU ]=  U5        U R                  U5        U R                  U5        g rl   )rs   ry   get_rotationr~   deg2radr   r   cossinset_transformr
   	translateset_rotationr   r   r   )	r   r   tr
angle_origthetadddxdyr"   s	           r   r   LabelBase.draw   s    !! !&&(


4112  bffUm#R"&&-%7B2
 4 4R <<=$..;<X2*%r   c                 R  > Uc  U R                  SS9R                  5       nU R                  5       nU R                  5       n[        R
                  " U R                  5      nU R                  nU[        R                  " U5      -  U[        R                  " U5      -  pvU R                  U[        5       R                  Xg5      -   5        U R                  U R                  U-   5        [        T	U ]A  U5      R#                  5       nU R                  U5        U R                  U5        U$ NTroot)
get_figure_get_rendererry   r   r~   r   r   r   r   r   r   r
   r   r   r   r   get_window_extentfrozen)
r   r   r   r   r   r   r   r   bboxr"   s
            r   r   LabelBase.get_window_extent   s    D1??AH !&&(


4112  bffUm#R"&&-%7B2
 4 4R <<=$..;<w(299;2*%r   )r   r   r   r7   rl   )r&   r'   r(   r)   r   r:   propertyr   r   __getitem___get_opposite_directionr   r   r*   r+   r,   s   @r   r   r      sc    +     (/(.&.).0 1< 
&$ r   r   c                      ^  \ rS rSrSrSSS.S jrS rS rS	 rU 4S
 jr	\
" SSSSS9rS r\
" SSSSS9rS rS rS rU 4S jrSU 4S jjrSrU =r$ )	AxisLabeli  a   
Axis label. Derived from `.Text`. The position of the text is updated
in the fly, so changing text position has no effect. Otherwise, the
properties can be changed as a normal `.Text`.

To change the pad between tick labels and axis label, use `set_pad`.
r   N)axis_directionr0   c                    X l         SU l        SU l        [        R                  " U /UQ70 UD6  U R                  U5        g )N   r   )r9   _pad_external_padr   r:   set_axis_direction)r   r   r0   r   r>   s        r   r:   AxisLabel.__init__  s<    
	41$1&1/r   c                     Xl         g)z
Set the internal pad in points.

The actual pad will be the sum of the internal pad and the
external pad (the latter is set automatically by the `.AxisArtist`).

Parameters
----------
pad : float
    The internal pad in points.
Nr   )r   pads     r   set_padAxisLabel.set_pad#  s	     	r   c                     U R                   $ )zF
Return the internal pad in points.

See `.set_pad` for more details.
r   r   s    r   get_padAxisLabel.get_pad1  s     yyr   c                 .    U R                   R                  $ rl   )r9   labelr   s    r   r   AxisLabel.get_ref_artist9  s    zzr   c                    > [         TU ]  5       nUS:X  a$  U R                  R                  R                  5       $ U R                  $ )N__from_axes__)r   get_textr9   r   _text)r   tr"   s     r   r   AxisLabel.get_text=  s;    G::##,,..zzr   )r   center)r   r   r   r   r   r   c                     [         R                  " U R                  US9u  p#U R                  U5        U R	                  U5        g)z
Set the default alignment. See `set_axis_direction` for details.

Parameters
----------
d : {"left", "bottom", "right", "top"}
dN)r   check_getitem_default_alignmentsset_vaset_ha)r   r   vahas       r   set_default_alignmentAxisLabel.set_default_alignmentI  s4     ##D$<$<BBBr   rr   r   c                 `    U R                  [        R                  " U R                  US95        g)z|
Set the default angle. See `set_axis_direction` for details.

Parameters
----------
d : {"left", "bottom", "right", "top"}
r   N)r   r   r   _default_anglesr   r   s     r   set_default_angleAxisLabel.set_default_angleZ  s%     	$,,T-A-AQGHr   c                 H    U R                  U5        U R                  U5        g)a  
Adjust the text angle and text alignment of axis label
according to the matplotlib convention.

=====================    ========== ========= ========== ==========
Property                 left       bottom    right      top
=====================    ========== ========= ========== ==========
axislabel angle          180        0         0          180
axislabel va             center     top       center     bottom
axislabel ha             right      center    right      center
=====================    ========== ========= ========== ==========

Note that the text angles are actually relative to (90 + angle
of the direction to the ticklabel), which gives 0 for bottom
axis.

Parameters
----------
d : {"left", "bottom", "right", "top"}
N)r   r   r   s     r   r   AxisLabel.set_axis_directiond  s     * 	""1%q!r   c                 $    U R                  S5      $ rN   rO   r   s    r   rP   AxisLabel.get_color|  rR   r   c                    > U R                  5       (       d  g U R                  UR                  U R                  5       5      -   U l        [
        TU ]  U5        g rl   )rs   r   r{   r   r   r   r   )r   r   r"   s     r   r   AxisLabel.draw  sL    !! !:!:4<<>!JJ 	 	Xr   c                    > Uc  U R                  SS9R                  5       nU R                  5       (       d  g U R                  UR	                  U R                  5       5      -   nX l        [        TU ]!  U5      nU$ r   )	r   r   rs   r   r{   r   r   r   r   )r   r   rbbr"   s       r   r   AxisLabel.get_window_extent  so    D1??AH!!!:!:4<<>!JJW&x0	r   )r9   r   r   r   rl   )r&   r'   r(   r)   r   r:   r   r   r   r   dictr   r   r   r   r   rP   r   r   r*   r+   r,   s   @r   r   r     s|     .6D 0  $8%6&7#79

 !""#"$O
I"0; r   r   c                      ^  \ rS rSrSrSS.U 4S jjrS rS rS rS	 r	\
" S
SSSS9r\
" SSSSS9rS rS rSS jrS rSrU =r$ )
TickLabelsi  a  
Tick labels. While derived from `.Text`, this single artist draws all
ticklabels. As in `.AxisLabel`, the position of the text is updated
in the fly, so changing text position has no effect. Otherwise,
the properties can be changed as a normal `.Text`. Unlike the
ticklabels of the mainline Matplotlib, properties of a single
ticklabel alone cannot be modified.

To change the pad between ticks and ticklabels, use `~.AxisLabel.set_pad`.
r   )r   c                V   > [         TU ]  " S0 UD6  U R                  U5        SU l        g )Nr   r%   )r   r:   r   _axislabel_pad)r   r   r>   r"   s      r   r:   TickLabels.__init__  s)    "6"/r   c                 <    U R                   R                  5       S   $ rA   )r9   get_ticklabelsr   s    r   r   TickLabels.get_ref_artist  s    zz((*1--r   c                 T    U R                  U5        U R                  U5        Xl        g)a;  
Adjust the text angle and text alignment of ticklabels
according to the Matplotlib convention.

The *label_direction* must be one of [left, right, bottom, top].

=====================    ========== ========= ========== ==========
Property                 left       bottom    right      top
=====================    ========== ========= ========== ==========
ticklabel angle          90         0         -90        180
ticklabel va             center     baseline  center     baseline
ticklabel ha             right      center    right      center
=====================    ========== ========= ========== ==========

Note that the text angles are actually relative to (90 + angle
of the direction to the ticklabel), which gives 0 for bottom
axis.

Parameters
----------
label_direction : {"left", "bottom", "right", "top"}

N)r   r   _axis_directionr   label_directions     r   r   TickLabels.set_axis_direction  s&    0 	""?3/.r   c                 \    U R                  U R                  5      nU R                  U5        g rl   )r   r  r   r  s     r   invert_axis_direction TickLabels.invert_axis_direction  s&    66t7K7KL0r   c                    U R                  U5      nU(       d  gSnU R                  5       U R                  5       peUS:X  a+  [        S U 5       5      nUS:X  a  UnXG4$ US:X  a  SU-  nXG4$ US:X  a+  [        S U 5       5      nUS:X  a  UnXG4$ US:X  a  SU-  nXG4$ US	:X  a^  [        S
 U 5       5      nUS	:X  a  UnXG4$ US:X  a  SU-  nXG4$ US:X  a*  [        S U 5       5      n[        S U 5       5      n	UnX-   nXG4$ US:X  a[  [        S U 5       5      nUS:X  a  UnXG4$ US:X  a  SU-  nXG4$ US:X  a*  [        S U 5       5      n[        S U 5       5      n	U	nX-   nUW4$ )a  
Calculate the ticklabel offsets from the tick and their total heights.

The offset only takes account the offset due to the vertical alignment
of the ticklabels: if axis direction is bottom and va is 'top', it will
return 0; if va is 'baseline', it will return (height-descent).
r   r   r   r   c              3   *   #    U  H	  u  po1v   M     g 7frl   r%   .0whr   s       r   	<genexpr>5TickLabels._get_ticklabels_offsets.<locals>.<genexpr>       0xGA!ax   r   g      ?r   c              3   *   #    U  H	  u  po1v   M     g 7frl   r%   r  s       r   r  r    r  r  r   c              3   *   #    U  H	  u  po2v   M     g 7frl   r%   r  s       r   r  r    r  r  baselinec              3   0   #    U  H  u  po2U-
  v   M     g 7frl   r%   r  s       r   r  r          ?h71Qh   c              3   *   #    U  H	  u  po3v   M     g 7frl   r%   r  s       r   r  r         !<8a!8r  r   c              3   *   #    U  H	  u  po2v   M     g 7frl   r%   r  s       r   r  r    r  r  c              3   0   #    U  H  u  po2U-
  v   M     g 7frl   r%   r  s       r   r  r    r  r  c              3   *   #    U  H	  u  po3v   M     g 7frl   r%   r  s       r   r  r    r  r  )!get_texts_widths_heights_descentsget_vaget_hamax)
r   r   r  whd_listr   r   r   r   
max_ascentmax_descents
             r   _get_ticklabels_offsets"TickLabels._get_ticklabels_offsets  s    99(CBf$0x00CV|F vE xHB vA '0x00CW}: v9 xH6 v5 (0x00CX~. v- xH* v) z!  ?h ??
!!<8!<< .  v %0x00CU{ v xH v z!  ?h ??
!!<8!<< .
 #vr   )r   r   )r   r   )r  r   r   r   ir   rr   c                    U R                  5       (       d  U R                  U l        g U R                  UU R                  5      u  p#U R                  UR                  U R                  5       5      -   nX$-   U l        U R                   Hm  u  u  pVpxUR                  5       (       d  M  Xpl
        U R                  U5        U R                  U5        U R                  U5        [        R                  X5        Mo     X4-   U l        g rl   )rs   r   r   r'  r  r{   r   r   _locs_angles_labelsstripr   set_xset_yset_textr   r   )	r   r   r   total_widthr   xyals	            r   r   TickLabels.draw  s    !!"&"4"4D55h6:6J6JL   8#<#<T\\^#LLg 44LFQA7799OJJqMJJqMMM!NN4* 5 */r   c                     Xl         g rl   )r*  )r   r7   s     r   set_locs_angles_labels!TickLabels.set_locs_angles_labels$  s    #5 r   c                 @   Uc  U R                  SS9R                  5       nU R                  5       (       d  U R                  U l        / $ / nU R                  UU R                  5      u  p4U R                  UR                  U R                  5       5      -   nX5-   U l	        U R                   Hg  u  u  pgpXl        U R                  U5        U R                  U5        U R                  U	5        [        R!                  X5      n
UR#                  U
5        Mi     XE-   U l        U$ r   )r   r   rs   r   r   r'  r  r{   r   r   r*  r   r,  r-  r.  r   r   append)r   r   bboxesr   r/  r   r0  r1  r2  r3  r   s              r   get_window_extentsTickLabels.get_window_extents'  s    D1??AH!!"&"4"4DI55h6:6J6JL   8#<#<T\\^#LLg 44LFQAOJJqMJJqMMM!,,T<BMM" 5 */r   c                     / nU R                    H[  u  p4nUR                  5       (       d  M  U R                  U5      u  pgUR                  X`R                  US9nUR                  U5        M]     U$ )zb
Return a list of ``(width, height, descent)`` tuples for ticklabels.

Empty labels are left out.
)ismath)r*  r+  _preprocess_mathget_text_width_height_descent_fontpropertiesr9  )	r   r   r$  _loc_angler   
clean_liner>  whds	            r   r   ,TickLabels.get_texts_widths_heights_descentsD  ss     #'#;#;D%;;==!%!6!6u!=J8800 9 ACOOC  $< r   )r  r   r*  r   r   rl   )r&   r'   r(   r)   r   r:   r   r   r  r'  r   r   r   r   r6  r;  r   r*   r+   r,   s   @r   r   r     su    	 *2    
./816p $7%7&<#9;
 !$"#"$O
0.6: r   r   c                   P   ^  \ rS rSrSSS.U 4S jjrS rS rS rU 4S	 jrS
r	U =r
$ )GridlinesCollectioniU  majorboth)whichr0   c                `   > Xl         X l        [        TU ]  " U0 UD6  U R	                  S5        g)z
Collection of grid lines.

Parameters
----------
which : {"major", "minor"}
    Which grid to consider.
axis : {"both", "x", "y"}
    Which axis to consider.
*args, **kwargs
    Passed to `.LineCollection`.
N)_whichr9   r   r:   set_grid_helper)r   rK  r0   r   r>   r"   s        r   r:   GridlinesCollection.__init__V  s/     
$)&)T"r   c                     Xl         g)zU
Select major or minor grid lines.

Parameters
----------
which : {"major", "minor"}
N)rM  )r   rK  s     r   	set_whichGridlinesCollection.set_whichh  s	     r   c                     Xl         g)z?
Select axis.

Parameters
----------
axis : {"both", "x", "y"}
N)r9   )r   r0   s     r   set_axisGridlinesCollection.set_axisr  s	     
r   c                     Xl         g)zR
Set grid helper.

Parameters
----------
grid_helper : `.GridHelperBase` subclass
N)_grid_helper)r   grid_helpers     r   rN  #GridlinesCollection.set_grid_helper|  s
     (r   c                 ^  > U R                   b  U R                   R                  U R                  5        U R                   R                  U R                  U R
                  5      nU R                  U Vs/ s H  n[        R                  " U5      PM     sn5        [        TU ])  U5        g s  snf rl   )rW  
update_limr   get_gridlinesrM  r9   set_segmentsr~   	transposer   r   )r   r   glr3  r"   s       r   r   GridlinesCollection.draw  s}    (((3""00djjIB;1r||A;<X <s   3 B*)r9   rW  rM  )r&   r'   r(   r)   r:   rQ  rT  rN  r   r*   r+   r,   s   @r   rH  rH  U  s+    $+& # #$( r   rH  c                   <  ^  \ rS rSrSrSr\S 5       r\R                  S 5       r  S%U 4S jjr	S r
S rS	 rS
 rS rS rS&S jrS rS rS rS rS rS&S jrS r\" SSSSS9rS rS rS rS rS rS rS  r S&S! jr!\"RF                  S" 5       r$S'S# jr%S$r&U =r'$ )(
AxisArtisti  z{
An artist which draws axis (a line along which the n-th axes coord
is constant) line, ticks, tick labels, and axis label.
g      @c                 6    U R                   R                  5       $ rl   )r   r   r   s    r   LABELPADAxisArtist.LABELPAD  s    zz!!##r   c                 :    U R                   R                  U5        g rl   )r   r   )r   vs     r   rd  re    s    

1r   c                   > [         TU ]  " S0 UD6  Xl        X l        Uc  Sn[	        / UQ[        5       R                  S5      U R                  R                  SS9R                  -   P76 U l	        US;   a  UR                  U l        OUR                  U l        SU l        X@l        U R                  5         U R                   " S0 UD6  U R#                  U5        U R%                  5         SU l        SU l        U R+                  U5        g)	z
Parameters
----------
axes : `mpl_toolkits.axisartist.axislines.Axes`
helper : `~mpl_toolkits.axisartist.axislines.AxisArtistHelper`
Nr  gqq?Fr   )r   r   r5   r%   )r   r:   r   _axis_artist_helperr   r
   rz   r   dpi_scale_transoffset_transformyaxisr0   xaxis_axisline_styler  
_init_line_init_ticks_init_offsetText_init_label_ticklabel_add_angle_axislabel_add_angler   )r   r   helperoffsetr   r>   r"   s         r   r:   AxisArtist.__init__  s     	"6"	#) >F 1 !@!@JV$ii""".>>?!@
 ..

DI

DI#-"6"n- %'!$&!/r   c                    U R                   R                  U5        U R                  R                  U5        Xl        US;   a#  U R	                  S5        U R                  S5        gU R	                  S5        U R                  S5        g)a  
Adjust the direction, text angle, and text alignment of tick labels
and axis labels following the Matplotlib convention for the rectangle
axes.

The *axis_direction* must be one of [left, right, bottom, top].

=====================    ========== ========= ========== ==========
Property                 left       bottom    right      top
=====================    ========== ========= ========== ==========
ticklabel direction      "-"        "+"       "+"        "-"
axislabel direction      "-"        "+"       "+"        "-"
ticklabel angle          90         0         -90        180
ticklabel va             center     baseline  center     baseline
ticklabel ha             right      center    right      center
axislabel angle          180        0         0          180
axislabel va             center     top       center     bottom
axislabel ha             right      center    right      center
=====================    ========== ========= ========== ==========

Note that the direction "+" and "-" are relative to the direction of
the increasing coordinate. Also, the text angles are actually
relative to (90 + angle of the direction to the ticklabel),
which gives 0 for bottom axis.

Parameters
----------
axis_direction : {"left", "bottom", "right", "top"}
)r   r   -+N)major_ticklabelsr   r   r  set_ticklabel_directionset_axislabel_direction)r   r   s     r   r   AxisArtist.set_axis_direction  sp    < 	00@

%%n5-_,((-((-((-((-r   c                 >    [         R                  " SSS.US9U l        g)z
Adjust the direction of the tick labels.

Note that the *tick_direction*\s '+' and '-' are relative to the
direction of the increasing coordinate.

Parameters
----------
tick_direction : {"+", "-"}
r   rr   rz  ry  )tick_directionN)r   r   rs  )r   r  s     r   r|  "AxisArtist.set_ticklabel_direction  s!     %)$6$6#~%?!r   c                     U R                   S-   S-  U l         U R                  R                  5         U R                  R                  5         g )Nrr   h  )rs  r{  r  minor_ticklabelsr   s    r   invert_ticklabel_direction%AxisArtist.invert_ticklabel_direction  s>    %)%>%>%D$K!335335r   c                 >    [         R                  " SSS.US9U l        g)z
Adjust the direction of the axis label.

Note that the *label_direction*\s '+' and '-' are relative to the
direction of the increasing coordinate.

Parameters
----------
label_direction : {"+", "-"}
r   rr   r  )r  N)r   r   rt  r  s     r   r}  "AxisArtist.set_axislabel_direction  s"     %)$6$6#%A!r   c                 H    U R                   R                  U R                  -   $ rl   )r   	transAxesrk  r   s    r   ry   AxisArtist.get_transform  s    yy""T%:%:::r   c                     U R                   $ )z%
Return axis artist helper instance.
)ri  r   s    r   
get_helperAxisArtist.get_helper  s     '''r   c                     Uc  [         R                  " 5       $ [        U[         R                  5      (       a  Xl        O[        U40 UD6U l        U R                  5         g)a!  
Set the axisline style.

The new style is completely defined by the passed attributes. Existing
style attributes are forgotten.

Parameters
----------
axisline_style : str or None
    The line style, e.g. '->', optionally followed by a comma-separated
    list of attributes. Alternatively, the attributes can be provided
    as keywords.

    If *None* this returns a string containing the available styles.

Examples
--------
The following two commands are equal:

>>> set_axisline_style("->,size=1.5")
>>> set_axisline_style("->", size=1.5)
N)r   pprint_styles
isinstance_Basern  ro  )r   axisline_styler>   s      r   set_axisline_styleAxisArtist.set_axisline_style  sN    . ! ..00nm&9&9::#1 #0#J6#JD r   c                     U R                   $ )z"Return the current axisline style.)rn  r   s    r   get_axisline_styleAxisArtist.get_axisline_style?  s    ###r   c           
         U R                   R                  U R                  5      U R                  -   nU R	                  5       nUc|  [        U R                   R                  U R                  5      [        R                  S   S[        R                  S   [        R                  S   [        R                  S   US9U l	        gU" XS9U l	        g)	zI
Initialize the *line* artist that is responsible to draw the axis line.
Nzaxes.edgecolorFzaxes.linewidthzlines.solid_capstylezlines.solid_joinstyle)r2   fill	linewidthcapstyle	joinstyle	transform)r  )
ri  get_line_transformr   rk  r  r   get_linemplrcParamsline)r   tranr  s      r   ro  AxisArtist._init_lineC  s     ((;;DIIF''( 002!!((11$))<ll#34,,'78&<=,,'>? DI 't<DIr   c                 >   U R                   R                  U R                  R                  U R                  5      5        U R                  5       b3  U R                   R                  U R                  R                  5       5        U R                   R                  U5        g rl   )
r  set_pathri  r  r   r  set_line_mutation_scaler{  get_sizer   r   r   s     r   
_draw_lineAxisArtist._draw_lineW  si    		433<<TYYGH""$0II--d.C.C.L.L.NO		x r   c                 @   U R                   R                  nU R                  R                  U R                  5      U R
                  -   n[        UR                  S[        R                  U S3   5      U R                   US9U l
        [        UR                  S[        R                  U S3   5      U R                   US9U l        [        R                  U S3   n[        U R                   U R                  U R                  R                  SS9UUUR                  S	[        R                  U S
3   5      S9U l        [        U R                   U R                  U R                  R                  SS9UUUR                  S[        R                  U S3   5      S9U l        g )Nmajor_tick_sizeztick.major.size)r0   r  minor_tick_sizeztick.minor.sizeztick.labelsizeFr   major_tick_padztick.major.pad)r0   r   figurer  fontsizer   minor_tick_padztick.minor.pad)r0   	axis_nameri  get_tick_transformr   rk  r.   getr  r  major_ticksminor_ticksr   r  r   r{  r  )r   r>   r  transsizes        r   rp  AxisArtist._init_ticks]  s~   II''	))<<TYYG(() !JJ!	{/:;= e	-
 !JJ!	{/:;= e	- ||yk89 *//99''U'3

 #,,)N/K"LN!
 !+//99''U'3

 #,,)N/K"LN!
r   c                     / n/ nU R                   nU HO  u  pVpxUS-
  U-   n	SX-
  S-  s=::  a  S::  a  O  OUOUS-   n
UR                  XZ/5        UR                  XYU/5        MQ     X#4$ )zj
Return a pair of:

- list of locs and angles for ticks
- list of locs, angles and labels for ticklabels.
r   r  i  rr   )rs  r9  )r   	tick_iterticks_loc_angleticklabels_loc_angle_labelticklabel_add_angler   angle_normalangle_tangentr   angle_label
angle_ticks              r   _get_tick_infoAxisArtist._get_tick_info  s     %'""777@3C}'",/BBKK$>##ELL '+c1  ""C#45&--s.GH 8A ::r   c                    Uc  U R                  SS9R                  5       nUR                  S5      nU R                  R	                  5       (       aY  U R                  R                  5       (       a:  U R                  R                  U-  nX0R                  l        X0R                  l        O"SU R                  l        SU R                  l        U R                  R                  U R                  5      u  pEU R                  U5      u  pgU R                  R                  U5        U R                  R                  U5        U R                  U5      u  pgU R                   R                  U5        U R                  R                  U5        g )NTr   rp   r   )r   r   r{   r  rs   ra   r6   r{  r   r  ri  get_tick_iteratorsr   r  rn   r6  r  )r   r   dpi_corticklabel_padmajortick_iterminortick_itertick_loc_angleticklabel_loc_angle_labels           r   _update_ticksAxisArtist._update_ticks  sG    D1??AH++B/''))d.>.>.K.K.M.M ,,66@M2?!!/2?!!/23D!!/23D!!/ $$77		B 	' / 	2((8445NO / 	2((8445NOr   c                    U R                  U5        U R                  R                  U5        U R                  R                  U5        U R                  R                  U5        U R
                  R                  U5        U R                  R                  5       (       d  U R
                  R                  5       (       a  U R                  U5        g g rl   )r  r  r   r{  r  r  rs   _draw_offsetTextr  s     r   _draw_ticksAxisArtist._draw_ticks  s    8$h'""8,h'""8,!!--//((4466!!(+ 7r   )r   r   r   r   )r   r   r   r   )r   r   r   r   )r   r   r   r   r   c                    U R                   U   u  p#pE[        R                  " SX#4SSS[        R                  S   XTS9U l        U R
                  R                  [        5       5        U R                  R                  U R
                  5        g )N zaxes fractionr  zoffset pointszxtick.color)xyxycoordsxytext
textcoordsr2   horizontalalignmentverticalalignment)
_offsetText_posmtext
Annotationr  r  
offsetTextr   r   r   _set_artist_props)r   	directionr0  r1  r   r   s         r   rq  AxisArtist._init_offsetText  st    ++I6b**vo,,}- "
 	%%&7&9:		##DOO4r   c                    U R                   R                  U R                  R                  R                  R                  5       5        U R                   R                  U R                  R                  5       5        U R                  R                  5       U R                  R                  5       -   S-   nSU4U R                   l
        g )N   r   )r  r.  r0   rI  	formatter
get_offsetset_sizer{  r  r   xyann)r   rv  s     r   _update_offsetTextAxisArtist._update_offsetText  s      !:!:!E!E!GH  !6!6!?!?!AB''//1))2245 "#Fr   c                 Z    U R                  5         U R                  R                  U5        g rl   )r  r  r   r  s     r   r  AxisArtist._draw_offsetText  s     !X&r   c                    U R                   R                  U R                  5      U R                  -   n[	        SSSSUR                  S[        R                  S   5      [        R                  S   U R                  UU R                  S9	U l
        U R                  R                  U R                  R                  SS	95        UR                  S
S5      nU R                  R                  U5        g )Nr   r   r   	labelsizezaxes.labelsizezaxes.labelweight)r2   r  
fontweightr0   r  r   Fr   labelpadr   )ri  get_axislabel_transformr   rk  r   r  r  r  r0   r  r   
set_figurer   r   )r   r>   r   r  s       r   rr  AxisArtist._init_label  s    &&>>tyyI%%&q/ZZS\\:J-KL||$67//

 	

dii222>?::j!,

8$r   c                     U R                   R                  5       (       d  g U R                  U R                  :w  a  U R                  R                  5       (       a  U R                  R                  5       (       a>  U R                  R                  5       (       a6  U R                  R                  5       (       d  U R                  R                  nO7SnO4[        U R                  R                  U R                  R                  5      nX R                   l        U R                  R                  U R                  5      u  p4Uc  g US-
  nUu  pgXPR                  -   U R                   l        U R                   R#                  XgS9  g )Nr   r   )r0  r1  )r   rs   rs  rt  r  ra   r  r6   r#  r{  r   r  r   ri  get_axislabel_pos_angler   r   set)r   r   axislabel_padr  r  r  r0  r1  s           r   _update_labelAxisArtist._update_label  s+   zz%%''$$(A(AA!!--//))6688$$0022 ,,99;; $ 0 0 : : ! 5 5 D D $ 5 5 D DFM $1

  $$<<TYYG 	:#b( +.G.G G



 r   c                 \    U R                  U5        U R                  R                  U5        g rl   )r  r   r   r  s     r   _draw_labelAxisArtist._draw_label	  s     8$

!r   c                 :    U R                   R                  U5        g rl   )r   r.  )r   ss     r   	set_labelAxisArtist.set_label  s    

Ar   c                    U R                  5       (       d  g U R                  R                  U R                  5        U R	                  U5        U R                  U5        U R                  R                  U R                  R                  U R                  5      5        U R                  5       b3  U R                  R                  U R                  R                  5       5        / U R                  R                  U5      QU R                  R                  U5      QU R                  R!                  U5      PU R"                  R!                  U5      PU R                  R!                  U5      PnU Vs/ s H/  o3(       d  M  UR$                  S:w  d  UR&                  S:w  d  M-  UPM1     nnU(       a  [(        R*                  " U5      nU$ g s  snf rA   )rs   ri  r[  r   r  r  r  r  r  r  r  r{  r  r;  r  r   r   r  widthheightr   union)r   r   r   r^   _bboxs        r   get_tightbboxAxisArtist.get_tightbbox  so   !!  ++DII68$8$		433<<TYYGH""$0II--d.C.C.L.L.NO
""55h?
""55h?
 JJ((2
 OO--h7	

 II''1
 EAqaagglahh!maEJJrNEL Fs   -
G;GGc                 N   U R                  5       (       d  g UR                  [        U R                  5       S9  U R                  R                  U R                  5        U R                  U5        U R                  U5        U R                  U5        UR                  [        5        g )N)gid)rs   
open_groupr&   get_gidri  r[  r   r  r  r  close_groupr  s     r   r   AxisArtist.draw*  s}     !!H$,,.9  ++DII6"!"X&r   c                 z   U(       a  Su  pVnOUb  Su  pVnOSu  pVnUb  UnUb  UnUb  UnUb6  U R                   R                  U5        U R                  R                  U5        Ub6  U R                  R                  U5        U R                  R                  U5        Ub  U R
                  R                  U5        gg)z
Toggle visibility of ticks, ticklabels, and (axis) label.
To turn all off, ::

  axis.toggle(all=False)

To turn all off but ticks on ::

  axis.toggle(all=False, ticks=True)

To turn all on but (axis) label off ::

  axis.toggle(all=True, label=False)

)TTTN)FFF)NNN)r  set_visibler  r{  r  r   )r   allticks
ticklabelsr   _ticks_ticklabels_labels           r   toggleAxisArtist.toggle6  s      *:'F_*='F*:'FF!$KF((0((0"!!--k:!!--k:JJ""6* r   )ri  r  rt  rn  rs  r   r0   r   r  r{  r  r  r  r  rk  )Nr   rl   )NNNN)(r&   r'   r(   r)   r   zorderr   rd  setterr:   r   r|  r  r}  ry   r  r  r  ro  r  rp  r  r  r  r   r  rq  r  r  rr  r  r  r  r  martistallow_rasterizationr   r  r*   r+   r,   s   @r   rb  rb    s    
 F$ $ __ 
  (*0\&.P?6
A;(B$=(!#
J;,P:,  9!9"88:O

5,'% !:"2   	' !	'%+ %+r   rb  )*r   operatorr   numpyr~   
matplotlibr  r   r   matplotlib.artistartistr  matplotlib.colorscolorsrG   matplotlib.texttextr  matplotlib.collectionsr   matplotlib.linesr   matplotlib.patchesr   matplotlib.pathr	   matplotlib.transformsr
   r   r   r   r  r   r   r.   Textr   r   r   rH  Artistrb  r%   r   r   <module>r.     s   CR "   " # #  1 # (  : : *I I]OV ]@E

 EP@ @F| |~6. 6rM+ M+r   