
    Le                         d dl Zd dlZd dlmZ d dlmZ ddlm	Z	 ddl
mZmZ ddlmZmZ dd	lmZ  G d
 de          Z G d dee          Z G d dee          Z G d dee          Z G d dee          ZdS )    N)colors)trisurf   )SkipRendering   )	CurvePlotScatterPlot)ColorbarPlotElementPlot)PlotlyOverlaySelectionDisplayc                   &   e Zd Z ej        d          Z ej        d          Z ej        d          Z ej	        d          Z
 ej        d          Z ej	        d          Z ej	        d          Z ej        dd	
          Zd ZdS )Chart3DPlotcube)default)皙?g      ?皙?r   )r   r   gr   3di  Nz
        Ticks along z-axis specified as an integer, explicit list of
        tick locations, list of tuples containing the locations.)r   docc                     t          |                    d          |                    d          |                    d                    gS )Nr   r      xyzdictdimension_valuesselfelementrangesstylekwargss        Alib/python3.11/site-packages/holoviews/plotting/plotly/chart3d.pyget_datazChart3DPlot.get_data    sP    w//22//22//224 4 4 5 	5    )__name__
__module____qualname__param	ParameteraspectNumericTuplecamera_anglecamera_positionIntegercamera_zoomString
projectionwidthheightzticksr%    r&   r$   r   r      s        U_V,,,F%5%.BCCCL(e(@@@O%-***Kd+++JEM#&&&EU]3'''FU_T 0D E E EF5 5 5 5 5r&   r   c                   \     e Zd Zg dZ ed          Zedd            Z fdZd Z	 xZ
S )SurfacePlot)visiblealphalightinglightpositioncmapFsupports_regionc                 
    ddiS )Ntypesurfacer7   clsis_geor#   s      r$   trace_kwargszSurfacePlot.trace_kwargs,   s    	""r&   c                      t                      j        |||fi |}|                     |j        d         |||          }t	          |fi |S )Nr   )supergraph_optionsget_color_optsvdimsr   r   r    r!   r"   r#   optscopts	__class__s          r$   rJ   zSurfacePlot.graph_options0   s[    $uww$WfeFFvFF##GM!$4gvuMMD""E"""r&   c                     t          |                    dd          |                    dd          |                    dd                    gS )Nr   Fr   r   )flatr   r   r   s        r$   r%   zSurfacePlot.get_data5   s^    w//599//599///>>@ @ @ A 	Ar&   F)r'   r(   r)   
style_optsr   selection_displayclassmethodrG   rJ   r%   __classcell__rP   s   @r$   r9   r9   &   s        JJJJ55eLLL# # # [## # # # #
A A A A A A Ar&   r9   c                   J    e Zd Zg dZdZ ed          Zedd            ZdS )Scatter3DPlot)r:   markercolorr>   r;   opacitysizesizeminFr?   c                     dddS )N	scatter3dmarkersrB   moder7   rD   s      r$   rG   zScatter3DPlot.trace_kwargsE   s    #Y777r&   NrS   )	r'   r(   r)   rT   _supports_geor   rU   rV   rG   r7   r&   r$   rZ   rZ   ;   s^          J M55eLLL8 8 8 [8 8 8r&   rZ   c                   D     e Zd ZdZg Zedd            Z fdZd Z xZ	S )
Path3DPlotTFc                     dddS )Nra   linesrc   r7   rD   s      r$   rG   zPath3DPlot.trace_kwargsP   s    #W555r&   c                 x     t                      j        |||fi |}|d                             dd            |S )Nline	showscale)rI   rJ   pop)r   r    r!   r"   r#   rN   rP   s         r$   rJ   zPath3DPlot.graph_optionsT   sD    $uww$WfeFFvFFVd+++r&   c                 >    d |                                 D             S )Nc           	          g | ]M}t          |                    d           |                    d          |                    d                    NS )r   r   r   r   r   ).0els     r$   
<listcomp>z'Path3DPlot.get_data.<locals>.<listcomp>Z   sh     + + + r**1--1D1DQ1G1G**1--/ / / + + +r&   )splitr   s        r$   r%   zPath3DPlot.get_dataY   s+    + +!--//+ + + 	+r&   rS   )
r'   r(   r)   
_per_trace_nonvectorized_stylesrV   rG   rJ   r%   rW   rX   s   @r$   rg   rg   J   sp        J6 6 6 [6    
+ + + + + + +r&   rg   c                   L     e Zd Zg dZ ed          Zd Z fdZddZ xZ	S )	TriSurfacePlot)r>   edges_color	facecolorFr?   c                    	 ddl m} n# t          $ r t          d          w xY wfdt	          d          D             \  }}}t          j        ||g          j        }	 ||	          }
|
j        }t          ||||          gS )Nr   )Delaunayz+SciPy not available, cannot plot TriSurfacec              3   B   K   | ]}                     |          V  d S )N)r   )rp   ir    s     r$   	<genexpr>z*TriSurfacePlot.get_data.<locals>.<genexpr>j   s1      AA17++A..AAAAAAr&   r   )r   r   r   	simplices)
scipy.spatialr{   ImportErrorr   rangenpvstackTr   r   )r   r    r!   r"   r#   r{   r   r   r   points2Dtrir   s    `          r$   r%   zTriSurfacePlot.get_datae   s    	O....... 	O 	O 	O MNNN	OAAAAaAAA1a9aV$$&hx  M	qAi88899s   
 $c                     t                      j        |||fi |}|                     |                                d         |||          }d |d         D             |d<   d |d         D             |d<   | j        |d<   |                    dd	          |d<   d|v |d
<   |                    dd           |d<   d |                                D             S )Nr   c                 j    g | ]0\  }}t          d  t          j        |          D                       1S )c              3       K   | ]	}|d z  V  
dS )g     o@Nr7   )rp   vs     r$   r~   z:TriSurfacePlot.graph_options.<locals>.<listcomp>.<genexpr>u   s&      !G!GQ!D&!G!G!G!G!G!Gr&   )tupler   
hex_to_rgb)rp   _cs      r$   rr   z0TriSurfacePlot.graph_options.<locals>.<listcomp>u   sN     = = = $1 "!G!G&2CA2F2F!G!G!GGG = = =r&   
colorscalecolormapc                     g | ]\  }}|S r7   r7   )rp   lr   s      r$   rr   z0TriSurfacePlot.graph_options.<locals>.<listcomp>w   s    ;;;tq!;;;r&   scaleshow_colorbarrx   black
plot_edgescolorbarc                 .    i | ]\  }}d |v	|dk    ||S )legendnamer7   )rp   kr   s      r$   
<dictcomp>z0TriSurfacePlot.graph_options.<locals>.<dictcomp>}   s-    SSSA1B1BqF{{1{{{r&   )rI   rJ   rK   
dimensionsr   getitemsrM   s          r$   rJ   zTriSurfacePlot.graph_optionsp   s   $uww$VU
 
&,
 
 ##G$6$6$8$8$;WfeTT= =(-l(;= = =Z;;u\':;;;W $_#iiw??]*e3\ 99Z66ZSSSSSSr&   r   c           	          |                     dd           }t          di t          |fi |}|r d |D             }|r||d         j        _        dd |D             iS )Nr   c                 >    g | ]}|j         d k    r|j        dk    |S )ra   rb   rc   )rp   traces     r$   rr   z-TriSurfacePlot.init_graph.<locals>.<listcomp>   s;     6 6 6u %
k 9 9"Z944 #444r&   r   tracesc                 6    g | ]}|                                 S r7   )to_plotly_json)rp   ts     r$   rr   z-TriSurfacePlot.init_graph.<locals>.<listcomp>   s$    III!1++--IIIr&   r7   )rm   
trisurfacer   r[   r   )r   datumoptionsindexr#   r   trisurface_tracesmarker_tracess           r$   
init_graphzTriSurfacePlot.init_graph   s     ;;z400&@@e)?)?w)?)?@@  	<6 60A 6 6 6M  <3;a '0II7HIIIJJr&   )r   )
r'   r(   r)   rT   r   rU   r%   rJ   r   rW   rX   s   @r$   rw   rw   _   s        555J55eLLL	: 	: 	:T T T T TK K K K K K K Kr&   rw   )numpyr   r*   plotlyr   plotly.figure_factory._trisurfr   r   core.optionsr   chartr   r	   r    r
   r   	selectionr   r   r9   rZ   rg   rw   r7   r&   r$   <module>r      s              @ @ @ @ @ @ ) ) ) ) ) ) ) ) ) ) ) ) ) ) . . . . . . . . 4 4 4 4 4 45 5 5 5 5+ 5 5 54A A A A A+| A A A*8 8 8 8 8K 8 8 8+ + + + +i + + +*0K 0K 0K 0K 0K[, 0K 0K 0K 0K 0Kr&   