
    6Dhj9                     j    S SK r S SKrS SKJr  S SKJr  S SKrS SKr	S SKJ
r
  SSKJr   " S S\5      rg)	    N)contextmanager)Version)
transforms   )utilsc                   *   \ rS rSr\S 5       r\S 5       r\S 5       r\S 5       r	\S 5       r
\S 5       r\S 5       r\S	 5       r\S
 5       rS rS rS rS rS rS r SS jrSS jr\S 5       r SS jrSS jr SS jr   SS jrSS jrSrg)Renderer   c                 F    [        U =(       a    U R                  5       5      $ N)boolget_navigateaxs    `/var/www/html/env/lib/python3.13/site-packages/plotly/matplotlylib/mplexporter/renderers/base.pyax_zoomableRenderer.ax_zoomable   s    B,2??,--    c                     [        U =(       a7    U R                  R                  =(       a    U R                  R	                  5       5      $ r   )r   xaxis_gridOnMajoryaxisget_gridlinesr   s    r   ax_has_xgridRenderer.ax_has_xgrid   .    BM28800MRXX5K5K5MNNr   c                     [        U =(       a7    U R                  R                  =(       a    U R                  R                  5       5      $ r   )r   r   r   r   r   s    r   ax_has_ygridRenderer.ax_has_ygrid   r   r   c                 8    U R                  U R                  5      $ r   )r   _current_axselfs    r   current_ax_zoomableRenderer.current_ax_zoomable   s     0 011r   c                 8    U R                  U R                  5      $ r   )r   r!   r"   s    r   current_ax_has_xgridRenderer.current_ax_has_xgrid         !1!122r   c                 8    U R                  U R                  5      $ r   )r   r!   r"   s    r   current_ax_has_ygridRenderer.current_ax_has_ygrid"   r)   r   c              #      #    [        U S5      (       a#  U R                  b  [        R                  " S5        Xl        X l        U R                  XS9  S v   U R                  US9  S U l        0 U l        g 7f)N_current_figz-figure embedded in figure: something is wrong)figprops)r/   )hasattrr.   warningswarn
_fig_propsopen_figureclose_figurer#   r/   r0   s      r   draw_figureRenderer.draw_figure&   si     4((T->->-JMMIJS.c"    A2A4c              #      #    [        U S5      (       a#  U R                  b  [        R                  " S5        Xl        X l        U R                  XS9  S v   U R                  US9  S U l        0 U l        g 7f)Nr!   z)axes embedded in axes: something is wrong)r   r0   r   )r1   r!   r2   r3   	_ax_props	open_axes
close_axesr#   r   r0   s      r   	draw_axesRenderer.draw_axes2   sc     4''D,<,<,HMMEF"*2r:   c              #      #    Xl         X l        U R                  XS9  S v   U R                  US9  S U l         0 U l        g 7f)N)legendr0   )rC   )_current_legend_legend_propsopen_legendclose_legendr#   rC   r0   s      r   draw_legendRenderer.draw_legend>   sF     %"4(#s   >A c                     g)z
Begin commands for a particular figure.

Parameters
----------
fig : matplotlib.Figure
    The Figure which will contain the ensuing axes and elements
props : dictionary
    The dictionary of figure properties
N r7   s      r   r5   Renderer.open_figureJ        	r   c                     g)z
Finish commands for a particular figure.

Parameters
----------
fig : matplotlib.Figure
    The figure which is finished being drawn.
NrL   )r#   r/   s     r   r6   Renderer.close_figureW        	r   c                     g)z
Begin commands for a particular axes.

Parameters
----------
ax : matplotlib.Axes
    The Axes which will contain the ensuing axes and elements
props : dictionary
    The dictionary of axes properties
NrL   r?   s      r   r=   Renderer.open_axesb   rN   r   c                     g)z
Finish commands for a particular axes.

Parameters
----------
ax : matplotlib.Axes
    The Axes which is finished being drawn.
NrL   )r#   r   s     r   r>   Renderer.close_axeso   rQ   r   c                     g)z
Beging commands for a particular legend.

Parameters
----------
legend : matplotlib.legend.Legend
        The Legend that will contain the ensuing elements
props : dictionary
        The dictionary of legend properties
NrL   rH   s      r   rF   Renderer.open_legendz   rN   r   c                     g)z
Finish commands for a particular legend.

Parameters
----------
legend : matplotlib.legend.Legend
        The Legend which is finished being drawn
NrL   )r#   rC   s     r   rG   Renderer.close_legend   rQ   r   Nc                 ^    Ub  U R                  XX5U5        Ub  U R                  XXEU5        gg)zDraw a line that also has markers.

If this isn't reimplemented by a renderer object, by default, it will
make a call to BOTH draw_line and draw_markers when both markerstyle
and linestyle are not None in the same Line2D object.

N)	draw_linedraw_markers)r#   datacoordinates	linestylemarkerstylelabelmplobjs          r   draw_marked_lineRenderer.draw_marked_line   s7      NN4iG"dVL #r   c                     S/UR                   S   S-
  S/-  -   n[        SSS0UD6nUR                  S5      US'   UR                  S	5      US
'   U R                  UUUUUS9  g)a  
Draw a line. By default, draw the line via the draw_path() command.
Some renderers might wish to override this and provide more
fine-grained behavior.

In matplotlib, lines are generally created via the plt.plot() command,
though this command also can create marker collections.

Parameters
----------
data : array_like
    A shape (N, 2) array of datapoints.
coordinates : string
    A string code, which should be either 'data' for data coordinates,
    or 'figure' for figure (pixel) coordinates.
style : dictionary
    a dictionary specifying the appearance of the line.
mplobj : matplotlib object
    the matplotlib plot element which generated this line
Mr      L	facecolornonecolor	edgecolor	linewidth	edgewidth)r]   r^   	pathcodesstylerb   NrL   )shapedictpop	draw_path)r#   r]   r^   rp   ra   rb   ro   	pathstyles           r   r[   Renderer.draw_line   s|    * ETZZ]Q.3%77	363U3	!*w!7	+!*{!;	+# 	 	
r   c                    [        [        U 5      [        U5      5      n[        [        R                  5      [        S5      :  a  Uc  [
        R                  " S5      /nUS   n[
        R                  " U5      S:X  a  S/nUS   n[
        R                  " U5      S:X  a  S/nU UUUUS   U/n[        nUR                  [        [        UR                  U5      6 U5      $ )z:Build an iterator over the elements of the path collectionz1.4.0   rl   r   rj   ri   rm   )maxlenr   mpl__version__npeyesize	itertoolsislicezipmapcycle)	pathspath_transformsoffsetsstylesNrl   ri   elementsits	            r   _iter_path_collectionRenderer._iter_path_collection   s     E
CL) 3??#gg&66&#%66!9+;'	779"I;'	779"I ;
 yyc"((H56::r   c	                 d   US:X  a  [        S5      eU R                  XXG5       H  n	U	u  pppU
u  nn[        R                  " U5      nUR	                  U5      nUS:X  a  Sn[
        R                  " U5      [
        R                  " U5      USUS   US   S.nU R                  UUUUUUUS	9  M     g
)a:  
Draw a collection of paths. The paths, offsets, and styles are all
iterables, and the number of paths is max(len(paths), len(offsets)).

By default, this is implemented via multiple calls to the draw_path()
function. For efficiency, Renderers may choose to customize this
implementation.

Examples of path collections created by matplotlib are scatter plots,
histograms, contour plots, and many others.

Parameters
----------
paths : list
    list of tuples, where each tuple has two elements:
    (data, pathcodes).  See draw_path() for a description of these.
path_coordinates: string
    the coordinates code for the paths, which should be either
    'data' for data coordinates, or 'figure' for figure (pixel)
    coordinates.
path_transforms: array_like
    an array of shape (*, 3, 3), giving a series of 2D Affine
    transforms for the paths. These encode translations, rotations,
    and scalings in the standard way.
offsets: array_like
    An array of offsets of shape (N, 2)
offset_coordinates : string
    the coordinates code for the offsets, which should be either
    'data' for data coordinates, or 'figure' for figure (pixel)
    coordinates.
offset_order : string
    either "before" or "after". This specifies whether the offset
    is applied before the path transform, or after.  The matplotlib
    backend equivalent is "before"->"data", "after"->"screen".
styles: dictionary
    A dictionary in which each value is a list of length N, containing
    the style(s) for the paths.
mplobj : matplotlib object
    the matplotlib plot element which generated this collection
beforezoffset before transformfigurepoints10,0alphazorder)rl   ri   rn   	dasharrayr   r   r]   r^   ro   rp   offsetoffset_coordinatesrb   N)NotImplementedErrorr   r   Affine2D	transformr   export_colorrt   )r#   r   path_coordinatesr   r   r   offset_orderr   rb   tuppathpath_transformr   eclwfcverticesro   rp   s                      r   draw_path_collectionRenderer.draw_path_collection   s    f 8#%&?@@--egVC9<6T6r"&Hi'00@N%//9H8+#+ "//3"//3# *E NN,##5  ! Wr   c                    ^ TS   u  pg[        U4S jS 5       5      nSUS'   U H  n	U R                  USUUU	UUS9  M     g)	a  
Draw a set of markers. By default, this is done by repeatedly
calling draw_path(), but renderers should generally overload
this method to provide a more efficient implementation.

In matplotlib, markers are created using the plt.plot() command.

Parameters
----------
data : array_like
    A shape (N, 2) array of datapoints.
coordinates : string
    A string code, which should be either 'data' for data coordinates,
    or 'figure' for figure (pixel) coordinates.
style : dictionary
    a dictionary specifying the appearance of the markers.
mplobj : matplotlib object
    the matplotlib plot element which generated this marker collection

markerpathc              3   2   >#    U  H  nUTU   4v   M     g 7fr   rL   ).0keyrp   s     r   	<genexpr>(Renderer.draw_markers.<locals>.<genexpr>E  s!      
Q %*Qs   )r   rl   ri   r   rn   r   r   r   r   N)rr   rt   )
r#   r]   r^   rp   ra   rb   r   ro   ru   vertexs
      `      r   r\   Renderer.draw_markers0  se    ( $L1 
Q
 
	 "(	+FNN$##.   r   c                     [        5       e)a  
Draw text on the image.

Parameters
----------
text : string
    The text to draw
position : tuple
    The (x, y) position of the text
coordinates : string
    A string code, which should be either 'data' for data coordinates,
    or 'figure' for figure (pixel) coordinates.
style : dictionary
    a dictionary specifying the appearance of the text.
text_type : string or None
    if specified, a type of text such as "xlabel", "ylabel", "title"
mplobj : matplotlib object
    the matplotlib plot element which generated this text
r   )r#   textpositionr^   rp   	text_typerb   s          r   	draw_textRenderer.draw_textU  s    , "##r   c                     [        5       e)a  
Draw a path.

In matplotlib, paths are created by filled regions, histograms,
contour plots, patches, etc.

Parameters
----------
data : array_like
    A shape (N, 2) array of datapoints.
coordinates : string
    A string code, which should be either 'data' for data coordinates,
    'figure' for figure (pixel) coordinates, or "points" for raw
    point coordinates (useful in conjunction with offsets, below).
pathcodes : list
    A list of single-character SVG pathcodes associated with the data.
    Path codes are one of ['M', 'm', 'L', 'l', 'Q', 'q', 'T', 't',
                           'S', 's', 'C', 'c', 'Z', 'z']
    See the SVG specification for details.  Note that some path codes
    consume more than one datapoint (while 'Z' consumes none), so
    in general, the length of the pathcodes list will not be the same
    as that of the data array.
style : dictionary
    a dictionary specifying the appearance of the line.
offset : list (optional)
    the (x, y) offset of the path. If not given, no offset will
    be used.
offset_coordinates : string (optional)
    A string code, which should be either 'data' for data coordinates,
    or 'figure' for figure (pixel) coordinates.
mplobj : matplotlib object
    the matplotlib plot element which generated this path
r   )r#   r]   r^   ro   rp   r   r   rb   s           r   rt   Renderer.draw_pathm  s    V "##r   c                     [        5       e)a  
Draw an image.

Parameters
----------
imdata : string
    base64 encoded png representation of the image
extent : list
    the axes extent of the image: [xmin, xmax, ymin, ymax]
coordinates: string
    A string code, which should be either 'data' for data coordinates,
    or 'figure' for figure (pixel) coordinates.
style : dictionary
    a dictionary specifying the appearance of the image
mplobj : matplotlib object
    the matplotlib plot object which generated this image
r   )r#   imdataextentr^   rp   rb   s         r   
draw_imageRenderer.draw_image  s    $ "##r   )r<   r!   r.   rD   r4   rE   r   )NN)Nr]   N)__name__
__module____qualname____firstlineno__staticmethodr   r   r   propertyr$   r'   r+   r   r8   r@   rI   r5   r6   r=   r>   rF   rG   rc   r[   r   r   r\   r   rt   r   __static_attributes__rL   r   r   r	   r	      s2   . . O O O O 2 2 3 3 3 3 	 	 	 	    			 HLM
B ; ;L N`#L JN$< !+$Z$r   r	   )r2   r   
contextlibr   packaging.versionr   numpyr}   
matplotlibr{   r    r   objectr	   rL   r   r   <module>r      s+      % %   ! _$v _$r   