
    hN                    0   S SK Jr  S SKrS SKJr  S SKJrJrJr  S SK	J
r  S SKJr  S SKrS SKJrJr  S SKJrJr  S SKJrJr  S SKJrJr  S S	KJr  \(       a  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\5      r* " S S\*5      r+ " S S\*5      r,g)    )annotationsN)pairwise)TYPE_CHECKINGAnycast)FillTypeLineType)convert_filledconvert_lines)as_fill_typeas_line_type)filled_to_mpl_pathslines_to_mpl_paths)Renderer)Sequence)Axes)Figure)	ArrayLikec                     \ rS rSr% SrS\S'   S\S'   S\S'         S             SS
 jjrSS jrSS jrSS jr	   S           SS jjr
     S               SS jjr    S              S!S jjr  S"           S#S jjrS$S%S jjrS&S jrSS jrS'S(S jjr    S)               S*S jjrSrg	)+MplRenderer   a{  Utility renderer using Matplotlib to render a grid of plots over the same (x, y) range.

Args:
    nrows (int, optional): Number of rows of plots, default ``1``.
    ncols (int, optional): Number of columns of plots, default ``1``.
    figsize (tuple(float, float), optional): Figure size in inches, default ``(9, 9)``.
    show_frame (bool, optional): Whether to show frame and axes ticks, default ``True``.
    backend (str, optional): Matplotlib backend to use or ``None`` for default backend.
        Default ``None``.
    gridspec_kw (dict, optional): Gridspec keyword arguments to pass to ``plt.subplots``,
        default None.
zSequence[Axes]_axesr   _figbool_want_tightNc                ,   Ub  SS K nUR                  U5        USSSS.nUb  XhS'   OSS0US'   [        R                  " X40 UD6u  U l        n	U	R                  5       U l        U(       d$  U R                   H  n
U
R                  S	5        M     SU l        g )
Nr   FT)figsizesqueezesharexshareygridspec_kwaspectequal
subplot_kwoff)	
matplotlibusepltsubplotsr   flattenr   axisr   )selfnrowsncolsr   
show_framebackendr!   mplkwargsaxesaxs              M/var/www/html/env/lib/python3.13/site-packages/contourpy/util/mpl_renderer.py__init__MplRenderer.__init__,   s     $GGG-4,0D"B"$/=!$,g#6F< ,,u>v>	4\\^
jj !      c                h    [        U S5      (       a!  [        R                  " U R                  5        g g )Nr   )hasattrr(   closer   r,   s    r5   __del__MplRenderer.__del__H   s$    4  IIdii  !r8   c                
   U R                    H-  n[        USS5      (       d  M  UR                  SS9  SUl        M/     U R                  (       a5  [        U R                   5      S:  a  U R                  R                  5         g g g )N_need_autoscaleFT)tight   )r   getattrautoscale_viewr@   r   lenr   tight_layoutr,   r4   s     r5   
_autoscaleMplRenderer._autoscaleL   sm     **Br,e44!!!-%*"  DJJ! 3II""$ !4r8   c                N    [        U[        5      (       a  U R                  U   nU$ N)
isinstanceintr   rG   s     r5   _get_axMplRenderer._get_axW   s!    b#BB	r8   c                    [        U5      nU R                  U5      n[        X5      n[        R                  " XdSSUS9nUR                  U5        SUl        g)a  Plot filled contours on a single Axes.

Args:
    filled (sequence of arrays): Filled contour data as returned by
        :meth:`~.ContourGenerator.filled`.
    fill_type (FillType or str): Type of :meth:`~.ContourGenerator.filled` data as returned
        by :attr:`~.ContourGenerator.fill_type`, or string equivalent
    ax (int or Maplotlib Axes, optional): Which axes to plot on, default ``0``.
    color (str, optional): Color to plot with. May be a string color or the letter ``"C"``
        followed by an integer in the range ``"C0"`` to ``"C9"`` to use a color from the
        ``tab10`` colormap. Default ``"C0"``.
    alpha (float, optional): Opacity to plot with, default ``0.7``.
noner   
facecolors
edgecolorslwalphaTN)r   rN   r   mcollectionsPathCollectionadd_collectionr@   )r,   filled	fill_typer4   colorrV   paths
collections           r5   rZ   MplRenderer.filled\   sV    * !+	\\"#F6!001EK

*%!r8   c                   U R                  U5      nU R                  X5      u  pXES.nUR                  " XUR                  UR                  40 UD6  US:  GaZ  SUSS2SS24   USS2SS24   -   USS2SS24   -   USS2SS24   -   -  n	SUSS2SS24   USS2SS24   -   USS2SS24   -   USS2SS24   -   -  n
XxS'   UR                  " [        R
                  " USS2SS24   XSS2SS24   45      R                  S5      [        R
                  " USS2SS24   XSS2SS24   45      R                  S5      [        R
                  " USS2SS24   XSS2SS24   45      R                  S5      [        R
                  " USS2SS24   XSS2SS24   45      R                  S5      40 UD6  Ub  UR                  XXeS	SS
9  SUl        g)a  Plot quad grid lines on a single Axes.

Args:
    x (array-like of shape (ny, nx) or (nx,)): The x-coordinates of the grid points.
    y (array-like of shape (ny, nx) or (ny,)): The y-coordinates of the grid points.
    ax (int or Matplotlib Axes, optional): Which Axes to plot on, default ``0``.
    color (str, optional): Color to plot grid lines, default ``"black"``.
    alpha (float, optional): Opacity to plot lines with, default ``0.1``.
    point_color (str, optional): Color to plot grid points or ``None`` if grid points
        should not be plotted, default ``None``.
    quad_as_tri_alpha (float, optional): Opacity to plot ``quad_as_tri`` grid, default 0.

Colors may be a string color or the letter ``"C"`` followed by an integer in the range
``"C0"`` to ``"C9"`` to use a color from the ``tab10`` colormap.

Warning:
    ``quad_as_tri_alpha > 0`` plots all quads as though they are unmasked.
)r\   rV   r   g      ?NrB   rV   )   ra   o)r\   rV   markerrU   T)rN   _grid_as_2dplotTnpstackreshaper@   )r,   xyr4   r\   rV   point_colorquad_as_tri_alphar2   xmidymids              r5   gridMplRenderer.gridy   s   8 \\"%+0!A
acc133)&)q 3B38qSbSz1Acrc12gJ>12qr6JKD3B38qSbSz1Acrc12gJ>12qr6JKD/7OGG!CRC"H+tqr12vY78@@I!CRC"H+tqr12vY78@@I!ABG*dcrc12gJ78@@I!ABG*dcrc12gJ78@@I	
  "GGAGK!r8   c                    [        U5      nU R                  U5      n[        X5      n[        R                  " USXFUS9nUR                  U5        SUl        g)a  Plot contour lines on a single Axes.

Args:
    lines (sequence of arrays): Contour line data as returned by
        :meth:`~.ContourGenerator.lines`.
    line_type (LineType or str): Type of :meth:`~.ContourGenerator.lines` data as returned
        by :attr:`~.ContourGenerator.line_type`, or string equivalent.
    ax (int or Matplotlib Axes, optional): Which Axes to plot on, default ``0``.
    color (str, optional): Color to plot lines. May be a string color or the letter ``"C"``
        followed by an integer in the range ``"C0"`` to ``"C9"`` to use a color from the
        ``tab10`` colormap. Default ``"C0"``.
    alpha (float, optional): Opacity to plot lines with, default ``1.0``.
    linewidth (float, optional): Width of lines, default ``1``.
rQ   rR   TN)r   rN   r   rW   rX   rY   r@   )	r,   lines	line_typer4   r\   rV   	linewidthr]   r^   s	            r5   rt   MplRenderer.lines   sV    . !+	\\""54!00fES

*%!r8   c                    [         R                  R                  U5      nU[         R                  R                  L a  gU R	                  U5      nU R                  X5      u  pUR                  X   X&   SUS9  g)a  Plot masked out grid points as circles on a single Axes.

Args:
    x (array-like of shape (ny, nx) or (nx,)): The x-coordinates of the grid points.
    y (array-like of shape (ny, nx) or (ny,)): The y-coordinates of the grid points.
    z (masked array of shape (ny, nx): z-values.
    ax (int or Matplotlib Axes, optional): Which Axes to plot on, default ``0``.
    color (str, optional): Circle color, default ``"black"``.
Nrc   )c)rh   magetmasknomaskrN   re   rf   )r,   rk   rl   zr4   r\   masks          r5   r~   MplRenderer.mask   sa    " uu}}Q255<<\\"%
#/r8   c                V    U R                  5         U R                  R                  XS9  g)zSave plots to SVG or PNG file.

Args:
    filename (str): Filename to save to.
    transparent (bool, optional): Whether background should be transparent, default
        ``False``.
)transparentN)rH   r   savefig)r,   filenamer   s      r5   saveMplRenderer.save   s#     			(<r8   c                    U R                  5         [        R                  " 5       nU R                  R	                  USS9  UR                  S5        U$ )zPSave plots to an ``io.BytesIO`` buffer.

Return:
    BytesIO: PNG image buffer.
png)formatr   )rH   ioBytesIOr   r   seek)r,   bufs     r5   save_to_bufferMplRenderer.save_to_buffer   s@     	jjl		#e,
r8   c                N    U R                  5         [        R                  " 5         g)zMShow plots in an interactive window, in the usual Matplotlib manner.
        N)rH   r(   showr<   s    r5   r   MplRenderer.show   s     	
r8   c                    U(       a  U R                  U5      R                  XS9  gU R                  U5      R                  U5        g)a  Set the title of a single Axes.

Args:
    title (str): Title text.
    ax (int or Matplotlib Axes, optional): Which Axes to set the title of, default ``0``.
    color (str, optional): Color to set title. May be a string color or the letter ``"C"``
        followed by an integer in the range ``"C0"`` to ``"C9"`` to use a color from the
        ``tab10`` colormap. Default is ``None`` which uses Matplotlib's default title color
        that depends on the stylesheet in use.
)r\   N)rN   	set_title)r,   titler4   r\   s       r5   r   MplRenderer.title   s8     LL&&u&:LL&&u-r8   c                   U R                  U5      nU R                  X5      u  p[        R                  " U5      nUR                  u  p[        U5       H9  n
[        U	5       H'  nUR                  XU4   X*U4   X:U4   U  SSUSS9  M)     M;     U(       a  [        US-
  5       H  n
[        U	S-
  5       H  n[        R                  " XU
S-   2XS-   24   [        R                  S9n[        R                  " X*U
S-   2XS-   24   [        R                  S9n[        R                  " X:U
S-   2XS-   24   5      nUR                  XX  SSUSS9  M     M     gg)a@  Show ``z`` values on a single Axes.

Args:
    x (array-like of shape (ny, nx) or (nx,)): The x-coordinates of the grid points.
    y (array-like of shape (ny, nx) or (ny,)): The y-coordinates of the grid points.
    z (array-like of shape (ny, nx): z-values.
    ax (int or Matplotlib Axes, optional): Which Axes to plot on, default ``0``.
    color (str, optional): Color of added text. May be a string color or the letter ``"C"``
        followed by an integer in the range ``"C0"`` to ``"C9"`` to use a color from the
        ``tab10`` colormap. Default ``"green"``.
    fmt (str, optional): Format to display z-values, default ``".1f"``.
    quad_as_tri (bool, optional): Whether to show z-values at the ``quad_as_tri`` centers
        of quads.

Warning:
    ``quad_as_tri=True`` shows z-values for all quads, even if masked.
centerThavar\   clip_onrB      dtypeN)	rN   re   rh   asarrayshaperangetextmeanfloat64)r,   rk   rl   r}   r4   r\   fmtquad_as_trinynxjixxyyzzs                  r5   z_valuesMplRenderer.z_values  sS   6 \\"%JJqMrA2YQ$a4Q!tWcUOh#T  3   2a4[r!tAQqS5!aC%<

CBQqS5!aC%<

CBQqS5!aC%<1BGGBr%jh8SX$(  *	 % ! r8   )r   r   r   )rB   rB   	   r   TNN)r-   rM   r.   rM   r   tuple[float, float]r/   r   r0   
str | Noner!   zdict[str, Any] | NonereturnNone)r   r   )r4   
Axes | intr   r   )r   C0ffffff?)rZ   cpy.FillReturnr[   FillType | strr4   r   r\   strrV   floatr   r   )r   black皙?Nr   )rk   r   rl   r   r4   r   r\   r   rV   r   rm   r   rn   r   r   r   )r   r         ?rB   )rt   cpy.LineReturnru   LineType | strr4   r   r\   r   rV   r   rv   r   r   r   )r   r   )rk   r   rl   r   r}   z'ArrayLike | np.ma.MaskedArray[Any, Any]r4   r   r\   r   r   r   )F)r   r   r   r   r   r   )r   z
io.BytesIO)r   N)r   r   r4   r   r\   r   r   r   )r   greenz.1fF)rk   r   rl   r   r}   r   r4   r   r\   r   r   r   r   r   r   r   )__name__
__module____qualname____firstlineno____doc____annotations__r6   r=   rH   rN   rZ   rq   rt   r~   r   r   r   r   r   __static_attributes__ r8   r5   r   r      sO    
L '-"-1     %	 
     +  
 8!	% "" "" 	"
 " " 
"B "&#$-"-" -" 	-"
 -" -"  -" !-" 
-"f "" "" 	"
 " " " 
"H 00 0 3	0
 0 0 
00	=
.* !**** ** 	**
 ** ** ** ** 
** **r8   r   c                  H   ^  \ rS rSrSr   S       SU 4S jjjrSrU =r$ )MplTestRendereri9  zTest renderer implemented using Matplotlib.

No whitespace around plots and no spines/ticks displayed.
Uses Agg backend, so can only save to file/buffer, cannot call ``show()``.
c           	        > SSSSSSS.n[         TU ]  XUSSUS9  U R                   HG  nUR                  S5        UR	                  S5        UR                  / 5        UR                  / 5        MI     SU l        g )	Ng{Gz?gGz?)leftrighttopbottomwspacehspaceTAgg)r/   r0   r!           F)superr6   r   set_xmarginset_ymargin
set_xticks
set_yticksr   )r,   r-   r.   r   gridspecr4   	__class__s         r5   r6   MplTestRenderer.__init__?  s     
 	'dEx 	 	
 **BNN3NN3MM"MM"	  !r8   )r   )rB   rB   r   )r-   rM   r.   rM   r   r   r   r   )r   r   r   r   r   r6   r   __classcell__r   s   @r5   r   r   9  sC     '-	!! ! %	!
 
! !r8   r   c                    ^  \ rS rSrSr    S         SU 4S jjjr              SS jr        S                     SU 4S jjjr       S                   SU 4S jjjr  S           SS jjr	  S           SS jjr
   S               SS	 jjrS
rU =r$ )MplDebugRendereriZ  zDebug renderer implemented using Matplotlib.

Extends ``MplRenderer`` to add extra information to help in debugging such as markers, arrows,
text, etc.
c                &   > [         TU ]  XX45        g rK   )r   r6   )r,   r-   r.   r   r/   r   s        r5   r6   MplDebugRenderer.__init__`  s     	w;r8   c                `   SX#-   -  nX2-
  nU[         R                  " [         R                  " X5      5      -  n[         R                  " US   US   * 45      n	[         R                  " XxS-  U	-
  U-  -
  XxS-  U-  -   XxS-  U	-   U-  -
  45      n
UR                  U
S S 2S4   U
S S 2S4   SXES9  g )Ng      ?rB   r   -ry   rV   )rh   sqrtdotr   ri   rf   )r,   r4   
line_startline_endr\   rV   
arrow_sizemidalongr   arrows              r5   _arrowMplDebugRenderer._arrowi  s     :()%-..

E!HuQxi019u$j00)J&&9u$j00
 
 	adU1a4[#Dr8   c                
  > [        U5      n[        TU ]	  XX4U5        Uc  Uc  g U R                  U5      n[	        X[
        R                  5      nUb  [        U6  H  u  pUc  M
  [        U5       Hm  u  pXU nUR                  US S 2S4   US S 2S4   XgS9  U
S:  d  M0  [        U5      n[        US-
  5       H   nU R                  X?U   UUS-      XgU
5        M"     Mo     M     Ub  [        U6  H  u  pUc  M
  [        R                  " US   [        S9nSUUSS  S-
  '   U	b
  US S nSUU'   UR                  US S 2S4   U   US S 2S4   U   SXS9  U	c  Mi  UR                  US S 2S4   W   US S 2S4   U   SXS9  M     g g )	Nr   rB   r   r   ra   r   Frc   )r   r   rZ   rN   r
   r   ChunkCombinedOffsetzipr   rf   rE   r   r   rh   onesr   )r,   rZ   r[   r4   r\   rV   
line_color
line_alpharm   start_point_colorr   pointsoffsetsstartendxysnr   r~   start_indicesr   s                       r5   rZ   MplDebugRenderer.filled}  s    !+	v"U;+"5\\"83O3OP !#&<>"*7"3JE s+CGGC1Is1a4yJGQ!C'H!&qsA KKFC!HjV`a ", #4 $0 "#&<>wwwr{$7&+WQR[]#$0$+CRLM*/D'1a4L&q!tT(:C;  b %0GGF1a4L71m9TVY/  C $0 #r8   c
           
       > [        U5      n[        TU ]	  XX4XV5        U	S:X  a  Uc  g U R                  U5      n[	        X[
        R                  5      n
[        (       a  [        [        R                  U
5      n
U	S:  aC  U
 H=  n[        [        U5      S-
  5       H  nU R                  X;U   XS-      XEU	5        M!     M?     Ub{  U
 Ht  nSn[        U5      nUbC  UR                  US   US   SXS9  SnUS   S   US   S   :X  a  US   S   US   S   :X  a  US-  nUR                  XU2S4   XU2S4   SXES9  Mv     g g )	Nr   rB   r   )r   r   )r   rB   rc   r   ra   )r   r   rt   rN   r   r	   Separater   r   cpyLineReturn_Separater   rE   r   rf   )r,   rt   ru   r4   r\   rV   rv   rm   r   r   separate_linesliner   start_index	end_indexr   s                  r5   rt   MplDebugRenderer.lines  sf    !+	e5D!4\\"&u9J9JK=!#"9"9>JN&s4y{+AKKGTA#YjQ , ' "&I	$0GGDJT
C;LGZ"#KAwqzT"Xa[0T!WQZ48A;5N!Q	2A56=RTU=U8VX[  . ' #r8   c                6   U R                  U5      nU R                  X5      u  p[        R                  " U5      nUR                  u  pg[        U5       HB  n[        U5       H0  n	XU-  -   n
UR                  XU	4   X(U	4   [        U
5      SSUSS9  M2     MD     g )Nr   r   Tr   rN   re   rh   r   r   r   r   r   )r,   rk   rl   r}   r4   r\   r   r   r   r   quads              r5   point_numbersMplDebugRenderer.point_numbers  s     \\"%JJqMrA2YR4xQ$a4#d)EQV $  &  r8   c                   U R                  U5      nU R                  X5      u  p[        R                  " U5      nUR                  u  pg[        SU5       H  n[        SU5       Ho  n	XU-  -   n
XS-
  US-   2U	S-
  U	S-   24   R                  5       nX(S-
  US-   2U	S-
  U	S-   24   R                  5       nUR                  X[        U
5      SSUSS9  Mq     M     g )NrB   r   Tr   )	rN   re   rh   r   r   r   r   r   r   )r,   rk   rl   r}   r4   r\   r   r   r   r   r  ro   rp   s                r5   quad_numbersMplDebugRenderer.quad_numbers  s     \\"%JJqMq"A1b\R4x1QqS!A#ac')*//11QqS!A#ac')*//1CI(xu^bc	 " r8   c                ^   U R                  U5      nU R                  X5      u  p[        R                  " U5      nUR                  u  p[        U5       HV  n
[        U	5       HD  nX:U4   nUb  X:  a  SnO
X:  a  SnOSnUR                  XU4   X*U4   [        U5      SSUSS9  MF     MX     g )Nr   rB   r   r   r   Tr   r
  )r,   rk   rl   r}   lower_levelupper_levelr4   r\   r   r   r   r   r   z_levels                 r5   z_levelsMplDebugRenderer.z_levels  s     \\"%JJqMrA2Y!tW*r/?G%GGQ$a4#g,6hV[ $  &  r8   r   )rB   rB   r   T)
r-   rM   r.   rM   r   r   r/   r   r   r   )r4   r   r   cpy.CoordinateArrayr   r  r\   r   rV   r   r   r   r   r   )r   C1r   r   r   r   redr   )rZ   r   r[   r   r4   r   r\   r   rV   r   r   r   r   r   rm   r   r   r   r   r   r   r   )r   r   r   rB   r   r  r   )rt   r   ru   r   r4   r   r\   r   rV   r   rv   r   rm   r   r   r   r   r   r   r   )r   r  )rk   r   rl   r   r}   r   r4   r   r\   r   r   r   )r   blue)Nr   r   )rk   r   rl   r   r}   r   r  r   r  zfloat | Noner4   r   r\   r   r   r   )r   r   r   r   r   r6   r   rZ   rt   r  r  r  r   r   r   s   @r5   r   r   Z  s    '-<< < %	<
 < 
< <EE (E &	E
 E E E 
E0 !&3C3C "3C 	3C
 3C 3C 3C 3C 3C 3C 3C 
3C 3Cr !&&.&. "&. 	&.
 &. &. &. &. &. &. 
&. &.Z && & 	&
 & & 
&. dd d 	d
 d d 
d2 %)&& & 	&
 & "& & & 
& &r8   r   )-
__future__r   r   	itertoolsr   typingr   r   r   matplotlib.collectionscollectionsrW   matplotlib.pyplotpyplotr(   numpyrh   	contourpyr   r	   contourpy.convertr
   r   contourpy.enum_utilr   r   contourpy.util.mpl_utilr   r   contourpy.util.rendererr   collections.abcr   matplotlib.axesr   matplotlib.figurer   numpy.typingr   contourpy._contourpy
_contourpyr  r   r   r   r   r8   r5   <module>r.     sh    " 	  + + -   ( ; : K ,($(&&[*( [*|!k !B}&{ }&r8   