
    el                         d dl Zd dlZd dlmZmZ d dlmZ d dlm	Z	 d dl
mZmZ d dlmZ d dlmZmZmZmZmZ d dlmZ d	d
lmZmZ  G d de          Z G d de          Z G d de          ZdS )    N)LineCollectionPolyCollection)Version)Dataset)AbbreviatedExceptionCycle)HoloMap)ChordGraphNodesTriMeshcircular_layout)dim   )TestMPLPlotmpl_rendererc                        e Zd Z fdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Z xZS )TestMplGraphPlotc                 6   t                                                       d}t          t          j        |t          j                            | _        t          j        |t          j                  | _        t          j        |t          j                  | _	        t          j
                            |          | _        t          | j        | j	        ff          | _        t          dgdg|dz
  z  z   dg          | _        t          | j        d          | _        t          | j        | j	        f| j        f          | _        t          | j        | j	        f| j        f          | _        t          | j        | j	        | j        ffd          | _        d S )	N   )dtypeOutputInputr   LabelvdimsWeight)supersetUpr   nparangeint32nodessourcezerostargetrandomrandweightsr   graphr   	node_info
node_info2graph2graph3graph4)selfN	__class__s     Rlib/python3.11/site-packages/holoviews/tests/plotting/matplotlib/test_graphplot.pyr   zTestMplGraphPlot.setUp   s<   $RYq%A%A%ABB
i222hq111y~~a((T[$+6899
 (WIqsO!;G9MMM!$,h???dk4;7HIIdk4;7IJJdk4;EGxXXX    c                    t          j        | j                  }|j        d         }|j        d         }|                     t          j        |                                          | j        j        	                    ddg                     |                     d |
                                D             d | j        j                                        D                        d S )Nr#   edgesr   r   c                     g | ]	}|j         
S  vertices.0ps     r3   
<listcomp>z;TestMplGraphPlot.test_plot_simple_graph.<locals>.<listcomp>%       @@@!*@@@r4   c                 6    g | ]}|                                 S r8   arrayr;   s     r3   r>   z;TestMplGraphPlot.test_plot_simple_graph.<locals>.<listcomp>&   s     JJJ!''))JJJr4   )r   get_plotr*   handlesassertEqualr    asarrayget_offsetsr#   rB   	get_paths	edgepathssplitr0   plotr#   r6   s       r3   test_plot_simple_graphz'TestMplGraphPlot.test_plot_simple_graph    s    $TZ00W%W%E$5$5$7$788$*:J:P:PRSUVQW:X:XYYY@@eoo.?.?@@@JJTZ-A-G-G-I-IJJJ	L 	L 	L 	L 	Lr4   c                 (   | j                             dd          }t          j        |          }|j        d         }t          j        g dg dg dg dg dg dg dg dg          }|                     |                                |           d S )Nr   Set1color_indexcmapr#   )g0?gR?gb_?      ?)333333?rT   rT   rS   )	r-   optsr   rC   rD   r    rB   rE   get_facecolors)r0   grL   r#   
facecolorss        r3   )test_plot_graph_categorical_colored_nodesz:TestMplGraphPlot.test_plot_graph_categorical_colored_nodes(   s    Kv>>$Q''W%XGGGGGGGGGGGGGGGGGGGGGGGGI J J
 	--//<<<<<r4   c                    | j                             dd          }t          j        |          }|j        d         }|                     t          j        |                                          | j	                   |                     |
                                | j	                                        | j	                                        f           d S )Nr   viridisrP   r#   )r.   rU   r   rC   rD   rE   r    rF   	get_arrayr)   get_climminmax)r0   rW   rL   r#   s       r3   )test_plot_graph_numerically_colored_nodesz:TestMplGraphPlot.test_plot_graph_numerically_colored_nodes6   s    K	BB$Q''W%EOO$5$566EEE))DL,<,<,>,>@P@P@R@R+STTTTTr4   c                 ,   | j                             dddg          }t          j        |          }|j        d         }t          j        g dg dg dg dg dg dg dg dg          }|                     |                                |           d S Nstart#FFFFFF#000000edge_color_index	edge_cmapr6   rS   rS   rS   rS           rk   rk   rS   )	r.   rU   r   rC   rD   r    rB   rE   
get_colorsr0   rW   rL   r6   colorss        r3   )test_plot_graph_categorical_colored_edgesz:TestMplGraphPlot.test_plot_graph_categorical_colored_edges=   s    K$I0F  
 
 $Q''W%++++++++++++++++++++++++- . . 	))++V44444r4   c                    | j                             dddg          }t          j        |          }|j        d         }|                     t          j        |                                          | j	                   |                     |
                                | j	                                        | j	                                        f           d S )Nr   rd   re   rf   r6   )r/   rU   r   rC   rD   rE   r    rF   r\   r)   r]   r^   r_   r0   rW   rL   r6   s       r3   )test_plot_graph_numerically_colored_edgesz:TestMplGraphPlot.test_plot_graph_numerically_colored_edgesM   s    K%)Y1G  
 
 $Q''W%EOO$5$566EEE))DL,<,<,>,>@P@P@R@R+STTTTTr4   c           	      F   ddg}t          g dd          }t          ||f                              d          }t          j        |          }|j        d         }|                     |                                t          j	        g dg d	g d
g                     d S )Nr   r   r      ))r   r   r   re   )r   r   r   #FF0000)r   r   rv   #00FF00colorr   
node_colorr#   r   r   r   r   r   r   r   r   r   r   r   r   )
r   r   rU   r   rC   rD   rE   rV   r    rB   r0   r6   r#   r*   rL   artists         r3   test_graph_op_node_colorz)TestMplGraphPlot.test_graph_op_node_colorZ   s     XXX#% % %uen%%**g*>>$U++g&..00<<<|||"LMM	O 	O 	O 	O 	Or4   c           	         ddgfd}t           |d           |d          d                              d          }t          j        |          }|j        d         }|                     |                                t          j        g d	g d
g dg                     |	                    d           |                     |                                t          j        g dg d	g d
g                     d S )Nrt   ru   c                     ddd|          \  }}}t          ddd|fddd|fddd|fgd          }t          |f          S )	N)rx   #0000FFrw   )rw   rx   r   rt   r   r   rv   ry   r   r   r   ic1c2c3r#   r6   s        r3   	get_graphzCTestMplGraphPlot.test_graph_op_node_color_update.<locals>.get_graphf   sp    >>@ @@ACJBBAq!R=1aB-!Q2G#% % %E%(((r4   r   r   ry   rz   r#   r~   r   r   r   r   r}   r   )
r	   rU   r   rC   rD   rE   rV   r    rB   updater0   r   r*   rL   r   r6   s        @r3   test_graph_op_node_color_updatez0TestMplGraphPlot.test_graph_op_node_color_updated   s*    	) 	) 	) 	) 	) IIaLLYYq\\::;;@@G@TT$U++g&..00<<<|||"LMM	O 	O 	OD..00<<<|||"LMM	O 	O 	O 	O 	Or4   c                    ddg}t          g dd          }t          ||f                              d          }t          j        |          }|j        d         }|                     t          j        |	                                          t          j
        g d                     |                     |                                d	           d S )
Nrt   ru   ))r   r   r         ?)r   r   r         ?)r   r   rv         @ry   r   rz   r#   r   r   r   r   r   )r   r   rU   r   rC   rD   rE   r    rF   r\   rB   r]   r   s         r3   test_graph_op_node_color_linearz0TestMplGraphPlot.test_graph_op_node_color_linearu   s     FFF#% % %uen%%**g*>>$U++g&F$4$4$6$677///9R9RSSS**J77777r4   c                    ddgfd}t           |d           |d          d                              dd          }t          j        |          }|j        d	         }|                     t          j        |                                          t          j	        g d
                     |                     |
                                d           |                    d           |                     t          j        |                                          t          j	        g d                     |                     |
                                d           d S )Nrt   ru   c                     ddd|          \  }}}t          ddd|fddd|fddd|fgd          }t          |f          S )	Nr      rv   r   rt   r   r   rv   ry   r   r   r   s        r3   r   zJTestMplGraphPlot.test_graph_op_node_color_linear_update.<locals>.get_graph   sm    ,&( (()+JBBAq!R=1aB-!Q2G#% % %E%(((r4   r   r   ry   Tr{   	framewiser#   r   r   r   r   r   r   )r	   rU   r   rC   rD   rE   r    rF   r\   rB   r]   r   r   s        @r3   &test_graph_op_node_color_linear_updatez7TestMplGraphPlot.test_graph_op_node_color_linear_update   sI    	) 	) 	) 	) 	) IIaLLYYq\\::;;@@G_c@dd$U++g&F$4$4$6$677///9R9RSSS**J777DF$4$4$6$677)))9L9LMMM**F33333r4   c                 \   ddg}t          g dd          }t          ||f                              d          }t          j        |          }|j        d         }|                     t          j        |	                                          t          j
        g d                     d S )	Nrt   ru   ))r   r   r   A)r   r   r   B)r   r   rv   r   ry   r   rz   r#   )r   r   r   )r   r   rU   r   rC   rD   rE   r    rF   r\   rB   r   s         r3   $test_graph_op_node_color_categoricalz5TestMplGraphPlot.test_graph_op_node_color_categorical   s     FFF#% % %uen%%**g*>>$U++g&F$4$4$6$677)))9L9LMMMMMr4   c                 8   ddg}t          g dd          }t          ||f                              d          }t          j        |          }|j        d         }|                     |                                t          j	        g d                     d S )	Nrt   ru   )r   r   r   rv   r   r   r      )r   r   rv      sizer   	node_sizer#   r      $   )
r   r   rU   r   rC   rD   rE   	get_sizesr    rB   r   s         r3   test_graph_op_node_sizez(TestMplGraphPlot.test_graph_op_node_size   s     @@@"$ $ $uen%%**V*<<$U++g&))++RXkkk-B-BCCCCCr4   c                    ddgfd}t           |d           |d          d                              d          }t          j        |          }|j        d         }|                     |                                t          j        g d	                     |	                    d
           |                     |                                t          j        g d                     d S )Nrt   ru   c                     ddd|          \  }}}t          ddd|fddd|fddd|fgd          }t          |f          S )	Nrv   r   r      r      rt   r   r   rv   r   r   r   r   s        r3   r   zBTestMplGraphPlot.test_graph_op_node_size_update.<locals>.get_graph   sm    &') ))*,JBBAq!R=1aB-!Q2G"$ $ $E%(((r4   r   r   r   r   r#   r   r   )   	      )
r	   rU   r   rC   rD   rE   r   r    rB   r   r   s        @r3   test_graph_op_node_size_updatez/TestMplGraphPlot.test_graph_op_node_size_update   s     	) 	) 	) 	) 	) IIaLLYYq\\::;;@@6@RR$U++g&))++RXkkk-B-BCCCD))++RXlll-C-CDDDDDr4   c                    ddg}t          g dd          }t          ||f                              d          }t          j        |          }|j        d         }|                     |                                g d           d S )	Nrt   ru   )r   r   )r   r   rv         @
line_widthr   node_linewidthr#   )rv   r   r   )r   r   rU   r   rC   rD   rE   get_linewidthsr   s         r3   test_graph_op_node_linewidthz-TestMplGraphPlot.test_graph_op_node_linewidth   s     BBB,WWWuen%%**,*GG$U++g&..00+++>>>>>r4   c                    ddgfd}t           |d           |d          d                              d          }t          j        |          }|j        d         }|                     |                                g d	           |                    d
           |                     |                                g d           d S )Nrt   ru   c                     ddd|          \  }}}t          ddd|fddd|fddd|fgd          }t          |f          S )	Nr   r   rt   r   r   rv   r   r   r   r   s        r3   r   zGTestMplGraphPlot.test_graph_op_node_linewidth_update.<locals>.get_graph   sm    &') ))*,JBBAq!R=1aB-!Q2G(* * *E%(((r4   r   r   r   r   r#   r   r   r   )r	   rU   r   rC   rD   rE   r   r   r   s        @r3   #test_graph_op_node_linewidth_updatez4TestMplGraphPlot.test_graph_op_node_linewidth_update   s     	) 	) 	) 	) 	) IIaLLYYq\\::;;@@P\@]]$U++g&..00)))<<<D..00***=====r4   c                 "   dd l }ddg}t          g dd          }t          ||f                              d          }t	          |j                  t	          d          k     rLd	}t          j        t          |
          5  t          j
        |           d d d            d S # 1 swxY w Y   d S t          j
        |          }|j        d         }|                     |                                t          j        g d                     d S )Nr   rt   ru   ))r   r   r   皙?)r   r   r   rT   )r   r   rv   r   alphar   
node_alpha3.4.0(TypeError: alpha must be a float or Nonematchr#   )r   rT   r   )
matplotlibr   r   rU   r   __version__pytestraisesr   r   rC   rD   rE   	get_alphar    rB   )r0   mplr6   r#   r*   msgrL   r   s           r3   test_graph_op_node_alphaz)TestMplGraphPlot.test_graph_op_node_alpha   sT        DDDGTTTuen%%**g*>>3?##gg&6&666<C33??? - -%e,,,- - - - - - - - - - - - - - - - - -  (//D\'*FV--//---1H1HIIIII   B%%B),B)c           	          g d}t          |d                              d          }t          j        |          }|j        d         }|                     |                                t          j        g dg dg dg                     d S )	N)r   r   red)r   rv   green)r   r   bluery   r   
edge_colorr6   rS   rk   rk   rS   rk   gW0?rk   rS   rk   rk   rS   rS   )	r   rU   r   rC   rD   rE   get_edgecolorsr    rB   r0   r6   r*   rL   s       r3   test_graph_op_edge_colorz)TestMplGraphPlot.test_graph_op_edge_color   s    @@@e7+++00G0DD$U++W%--//   "="="=   ;" 2
 2
 	 	 	 	 	r4   c           	         t          t          g dd          t          g dd          d                              d          }t          j        |          }|j        d         }|                     |                                t          j	        g dg d	g d
g                     |
                    d           |                     |                                t          j	        g d	g d
g dg                     d S )Nr   ry   r   ))r   r   r   )r   rv   r   )r   r   r   rt   r   r6   r   r   r   r   )r	   r   rU   r   rC   rD   rE   r   r    rB   r   r0   r*   rL   r6   s       r3   test_graph_op_edge_color_updatez0TestMplGraphPlot.test_graph_op_edge_color_update   sO   EEE!# # #EEE"$ $ $% % & & '+dgd&>&>	 	
 $U++W%--//   "="="=   ;" 2
 2
 	 	 	 	D--//''')=)=)=   ;" 2
 2
 	 	 	 	 	r4   c                    g d}t          |d                              d          }t          j        |          }|j        d         }|                     t          j        |                                          t          j	        g d                     |                     |
                                d           d S )Nr   r   rv   r   rv   r   )r   r   r   ry   r   r   r6   rv   r   r   r   r   r   rU   r   rC   rD   rE   r    rF   r\   rB   r]   r   s       r3   test_graph_op_edge_color_linearz0TestMplGraphPlot.test_graph_op_edge_color_linear   s    333e7+++00G0DD$U++W%EOO$5$5668M8MNNN))844444r4   c                    t          t          g dd          t          g dd          d                              dd          }t          j        |          }|j        d         }|                     t          j        |	                                          t          j
        g d	                     |                     |                                d
           |                    d           |                     t          j        |	                                          t          j
        g d                     |                     |                                d           d S )Nr   ry   r   )r   r   333333@)r   rv   ffffff?)r   r   @rt   Tr   r   r6   r   r   r   r   r   r   )r   r   )r	   r   rU   r   rC   rD   rE   r    rF   r\   rB   r]   r   r   s       r3   &test_graph_op_edge_color_linear_updatez7TestMplGraphPlot.test_graph_op_edge_color_linear_update   sS   888!# # #<<<"$ $ $% % & & '+dgd&N&N	 	
 $U++W%EOO$5$5668M8MNNN))8444DEOO$5$5668Q8QRRR)):66666r4   c                    g d}t          |d                              d          }t          j        |          }|j        d         }|                     t          j        |                                          t          j	        g d                     |                     |
                                d           d S )N))r   r   C)r   rv   r   )r   r   r   ry   r   r   r6   r   ru   r   r   s       r3   $test_graph_op_edge_color_categoricalz5TestMplGraphPlot.test_graph_op_edge_color_categorical
  s    777e7+++00G0DD$U++W%EOO$5$5668K8KLLL))622222r4   c                     g d}t          |d                              d          }d}t          j        t          |          5  t          j        |           d d d            d S # 1 swxY w Y   d S )N))r   r   g?r   )r   r   333333?r   r   
edge_alpha9ValueError: Mapping a dimension to the "edge_alpha" styler   )r   rU   r   r   r   r   rC   )r0   r6   r*   r   s       r3   test_graph_op_edge_alphaz)TestMplGraphPlot.test_graph_op_edge_alpha  s    777e7+++00G0DDI]/s;;; 	) 	)!%(((	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	)s   A))A-0A-c                     g d}t          |d                              d          }t          j        |          }|j        d         }|                     |                                g d           d S )N)r   )r   rv   
   )r   r   r   r   r   edge_linewidthr6   )rv   r  r   )r   rU   r   rC   rD   rE   r   r   s       r3   test_graph_op_edge_linewidthz-TestMplGraphPlot.test_graph_op_edge_linewidth  sx    222e<00055\5RR$U++W%--//<<<<<r4   c                    t          t          g dd          t          g dd          d                              d          }t          j        |          }|j        d         }|                     |                                g d           |                    d	           |                     |                                g d
           d S )Nr   r   r   r   rt   r  r6   r   r   r   )	r	   r   rU   r   rC   rD   rE   r   r   r   s       r3   $test_graph_op_edge_line_width_updatez5TestMplGraphPlot.test_graph_op_edge_line_width_update   s    888&( ( (<<<') ) )* * + + ,04|4+L+L	 	
 $U++W%--//===D--//AAAAAr4   )__name__
__module____qualname__r   rM   rY   r`   ro   rr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  __classcell__r2   s   @r3   r   r      s       Y Y Y Y YL L L= = =U U U5 5 5 U U UO O OO O O"8 8 84 4 4"N N ND D DE E E? ? ?> > >J J J     $5 5 57 7 73 3 3) ) )= = =
B 
B 
B 
B 
B 
B 
Br4   r   c                        e Zd Z fdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zd Zd Zd Zd Zd Z xZS )TestMplTriMeshPlotc                     t                                                       g d| _        ddg| _        t	          | j        | j        f          | _        t	          | j        | j        fd          | _        d S )N))r   r   r   )r   r   r   )rS   r   rv   )r   r   r   r   r   rv   r   )r   rv   r   r   weightr   )r   r   r#   	simplicesr   trimeshtrimesh_weightedr0   r2   s    r3   r   zTestMplTriMeshPlot.setUp0  si    FFF
&5
;<< '(DH U U Ur4   c                    t          j        | j                  }|j        d         }|j        d         }|                     |t
                     |                     t          j        |	                                          | j        j
                            ddg                     |                     d |                                D             d | j        j                                        D                        d S )Nr#   r6   r   r   c                     g | ]	}|j         
S r8   r9   r;   s     r3   r>   z?TestMplTriMeshPlot.test_plot_simple_trimesh.<locals>.<listcomp>>  r?   r4   c                 6    g | ]}|                                 S r8   rA   r;   s     r3   r>   z?TestMplTriMeshPlot.test_plot_simple_trimesh.<locals>.<listcomp>?  s     SSS!''))SSSr4   )r   rC   r  rD   assertIsInstancer   rE   r    rF   rG   r#   rB   rH   _split_edgepathsrJ   rK   s       r3   test_plot_simple_trimeshz+TestMplTriMeshPlot.test_plot_simple_trimesh8  s    $T\22W%W%e^444E$5$5$7$788$,:L:R:RTUWXSY:Z:Z[[[@@eoo.?.?@@@SST\-J-P-P-R-RSSS	U 	U 	U 	U 	Ur4   c                     t          j        | j                            d                    }|j        d         }|j        d         }|                     |t                     |                     t          j	        |
                                          | j        j                            ddg                     | j        j                            d          }|                     d	 |                                D             |           d S )
NT)filledr#   r6   r   r   rB   )datatypec                 ,    g | ]}|j         d d         S )Nr   r9   r;   s     r3   r>   zFTestMplTriMeshPlot.test_plot_simple_trimesh_filled.<locals>.<listcomp>H  s"    DDDQ!*RaR.DDDr4   )r   rC   r  rU   rD   r  r   rE   r    rF   rG   r#   rB   r  rJ   rH   )r0   rL   r#   r6   pathss        r3   test_plot_simple_trimesh_filledz2TestMplTriMeshPlot.test_plot_simple_trimesh_filledA  s    $T\%6%6d%6%C%CDDW%W%e^444E$5$5$7$788$,:L:R:RTUWXSY:Z:Z[[[-33W3EEDD%//2C2CDDD	  	  	  	  	 r4   c                    t          dd          }t          j         | j        j        di |          }|j        d         }t          j        g dg dg          }|                     |	                                |           d S )Nr  Greysrf   r6   ri   rj   r8   )
dictr   rC   r  rU   rD   r    rB   rE   r   r0   rU   rL   r6   rn   s        r3   test_plot_trimesh_colored_edgesz2TestMplTriMeshPlot.test_plot_trimesh_colored_edgesK  s    XAAA$%?T%:%?%G%G$%G%GHHW%//////1 2 2--//88888r4   c                 (   t          dt          d                    }t          j         | j        j        di |          }|j        d         }t          j        g dg dg          }| 	                    |
                                |           d S )Nnode1rO   )rg   r   r6   gJzZ?g2w?gPl?rS   gF?N?gZ?gk?rS   r8   )r#  r   r   rC   r  rU   rD   r    rB   rE   r   r$  s        r3   -test_plot_trimesh_categorically_colored_edgesz@TestMplTriMeshPlot.test_plot_trimesh_categorically_colored_edgesS  s    WvGGG$%?T%:%?%G%G$%G%GHHW%======? @ @--//88888r4   c                 *   t          ddt          d                    }t          j         | j        j        di |          }|j        d         }t          j        g dg dg          }| 	                    |
                                |           d S )	Nr'  TrO   )rg   r  r   r6   r(  r)  r8   )r#  r   r   rC   r  rU   rD   r    rB   rE   rV   r$  s        r3   4test_plot_trimesh_categorically_colored_edges_filledzGTestMplTriMeshPlot.test_plot_trimesh_categorically_colored_edges_filled[  s    WTeFmmTTT$%?T%:%?%G%G$%G%GHHW%======? @ @--//88888r4   c           
      L   ddg}g d}t          |t          |d          f                              d          }t          j        |          }|j        d         }|                     |                                t          j	        g dg d	g d
g dg                     d S )Nr   r   rv   r   ))r/  r   r   )r   r   r   r   )r   r   rv   r   )r   r   r   blackry   r   rz   r#   r}   r   g3ۃ?r   r   r   r|   )
r   r   rU   r   rC   rD   rE   rV   r    rB   r0   r6   r#   r  rL   r   s         r3   test_trimesh_op_node_colorz-TestMplTriMeshPlot.test_trimesh_op_node_colorg  s    I&___5%W"="="=>??DDPWDXX$W--g&..00<<<1D1D1DlllT`T`T`"abb	d 	d 	d 	d 	dr4   c                    ddg}g d}t          |t          |d          f                              d          }t          j        |          }|j        d         }|                     t          j        |	                                          t          j
        g d                     |                     |                                d	           d S )
Nr   r.  )r/  r/  r   rv   r   r   r   rv   r   r   r   r   r   ry   r   rz   r#   )rv   r   r   r   r   r   r   r   rU   r   rC   rD   rE   r    rF   r\   rB   r]   r2  s         r3   !test_trimesh_op_node_color_linearz4TestMplTriMeshPlot.test_trimesh_op_node_color_linearp  s    I&JJJ5%W"="="=>??DDPWDXX$W--g&F$4$4$6$677,,,9O9OPPP**F33333r4   c                    ddg}g d}t          |t          |d          f                              d          }t          j        |          }|j        d         }|                     t          j        |	                                          t          j
        g d                     |                     |                                d	           d S )
Nr   r.  ))r/  r/  r   r   )r   r   r   r   r   r   rv   r   )r   r   r   r   ry   r   rz   r#   r  ru   r9  r2  s         r3   &test_trimesh_op_node_color_categoricalz9TestMplTriMeshPlot.test_trimesh_op_node_color_categoricaly  s    I&RRR5%W"="="=>??DDPWDXX$W--g&F$4$4$6$677,,,9O9OPPP**F33333r4   c                 8   ddg}g d}t          |t          |d          f                              d          }t          j        |          }|j        d         }|                     |                                t          j	        g d                     d S )	Nr   r.  ))r/  r/  r   r   )r   r   r   rv   )r   r   rv   r   r7  r   r   r   r#   )r   r   @   r   )
r   r   rU   r   rC   rD   rE   r   r    rB   r2  s         r3   test_trimesh_op_node_sizez,TestMplTriMeshPlot.test_trimesh_op_node_size  s    I&JJJ5%V"<"<"<=>>CCfCUU$W--g&))++RXnnn-E-EFFFFFr4   c                 "   dd l }ddg}g d}t          |t          |d          f                              d          }t	          |j                  t	          d          k     rLd	}t          j        t          |
          5  t          j
        |           d d d            d S # 1 swxY w Y   d S t          j
        |          }|j        d         }|                     |                                t          j        g d                     d S )Nr   r   r.  )r/  r/  r   r   )r   r   r   rT   )r   r   rv   r   )r   r   r   r   r   r   r   r   r   r   r#   r   rT   r   r   )r   r   r   rU   r   r   r   r   r   r   rC   rD   rE   r   r    rB   )r0   r   r6   r#   r  r   rL   r   s           r3   test_trimesh_op_node_alphaz-TestMplTriMeshPlot.test_trimesh_op_node_alpha  sX       I&PPP5%W"="="=>??DDPWDXX3?##gg&6&666<C33??? / /%g.../ / / / / / / / / / / / / / / / / /  (11D\'*FV--//:L:L:L1M1MNNNNNr   c                    ddg}g d}t          |t          |d          f                              d          }t          j        |          }|j        d         }|                     |                                g d           d S )	Nr   r.  rB  r   r   r   r#   rC  )r   r   rU   r   rC   rD   rE   r   r2  s         r3   test_trimesh_op_node_line_widthz2TestMplTriMeshPlot.test_trimesh_op_node_line_width  s    I&PPP5%\"B"B"BCDDIIYeIff$W--g&..002D2D2DEEEEEr4   c                    ddg}g d}t          |t          |d          f                              d          }t          j        |          }|j        d         }|                     t          j        |	                                          t          j
        dd	g                     |                     |                                d
           d S )Nr   r.  r5  ry   r   r   r6   rv   gUUUUUU@r8  r9  r2  s         r3   +test_trimesh_op_edge_color_linear_mean_nodez>TestMplTriMeshPlot.test_trimesh_op_edge_color_linear_mean_node  s    I&JJJ5%W"="="=>??DDPWDXX$W--g&F$4$4$6$6771d)9L9LMMM**F33333r4   c                 &   ddg}g d}t          ||fd                              d          }t          j        |          }|j        d         }|                     |                                t          j        g dg d	g                     d S )
N)r   r   rv   r   )r   rv   r   r   )r/  r/  r   r   r   r   r   )r   r   r   ry   r   r   r6   r}   r   )	r   rU   r   rC   rD   rE   r   r    rB   r2  s         r3   test_trimesh_op_edge_colorz-TestMplTriMeshPlot.test_trimesh_op_edge_color  s    !#45>>>5%.888===QQ$W--g&..00"(LL,,,<( 3) 3) 	* 	* 	* 	* 	*r4   c                    ddg}g d}t          ||fd                              d          }t          j        |          }|j        d         }|                     t          j        |                                          t          j	        dd	g                     |                     |
                                d
           d S )N)r   r   rv   333333@)r   rv   r   @rJ  ry   r   r   r6   rN  rO  )rN  rO  r   rU   r   rC   rD   rE   r    rF   r\   rB   r]   r2  s         r3   !test_trimesh_op_edge_color_linearz4TestMplTriMeshPlot.test_trimesh_op_edge_color_linear  s    0>>>5%.888===QQ$W--g&F$4$4$6$6773*9M9MNNN**J77777r4   c                    ddg}g d}t          ||fd                              d          }t          j        |          }|j        d         }|                     t          j        |                                          t          j	        dd	g                     |                     |
                                d
           d S )Nr<  )r   rv   r   r   rJ  ry   r   r   r6   r   r   rt   rP  r2  s         r3   &test_trimesh_op_edge_color_categoricalz9TestMplTriMeshPlot.test_trimesh_op_edge_color_categorical  s    0>>>5%.888===QQ$W--g&F$4$4$6$6771a&9I9IJJJ**F33333r4   c                     ddg}g d}t          ||fd                              d          }d}t          j        t          |          5  t          j        |           d d d            d S # 1 swxY w Y   d S )	N)r   r   rv   gffffff?)r   rv   r   r   rJ  r   r   r   r   r   )r   rU   r   r   r   r   rC   )r0   r6   r#   r  r   s        r3   test_trimesh_op_edge_alphaz-TestMplTriMeshPlot.test_trimesh_op_edge_alpha  s    0>>>5%.888===QQI]/s;;; 	+ 	+!'***	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+s   A//A36A3c                     ddg}g d}t          ||fd                              d          }t          j        |          }|j        d         }|                     |                                dd	g           d S )
N)r   r   rv      )r   rv   r   r   rJ  r   r   r  r6   rW  r   )r   rU   r   rC   rD   rE   r   r2  s         r3   test_trimesh_op_edge_line_widthz2TestMplTriMeshPlot.test_trimesh_op_edge_line_width  s    |,>>>5%.===BBR^B__$W--g&..001a&99999r4   )r  r  r	  r   r  r   r%  r*  r,  r3  r:  r=  r@  rD  rF  rH  rL  rQ  rS  rU  rX  r
  r  s   @r3   r  r  .  sK       V V V V VU U U     9 9 99 9 99 9 9d d d4 4 44 4 4G G GO O O"F F F4 4 4* * *8 8 84 4 4+ + +: : : : : : :r4   r  c                   `     e Zd Z fdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Z xZS )TestMplChordPlotc                     t                                                       g d| _        t          g ddd          | _        t          | j        | j        f          | _        d S )N))r   r   r   )r   rv   rv   r.  ))r   r   )r   r   )rv   r   indexr   )r   r   r6   r   r#   r
   chordr  s    r3   r   zTestMplChordPlot.setUp  sW    666
;;;WgNN
DJ
344


r4   c                     ddd|z   fddd|z   fddd|z   fg}t          dd|z   fdd|z   fdd|z   fgdd          }t          ||fd          S )	Nr   r   rv   r   r\  r   r  r   )r   r
   )r0   r   r6   r#   s       r3   
make_chordzTestMplChordPlot.make_chord  ss    Q!q!QqSkAq!A#;7!QqSAqs8a1X6IIeU^84444r4   c                     | j                             d          }t          j        |          }|j        d         }|                     d |D             g d           d S )Nr   )label_indexlabelsc                 6    g | ]}|                                 S r8   get_textr<   ls     r3   r>   z@TestMplChordPlot.test_chord_nodes_label_text.<locals>.<listcomp>       7771!**,,777r4   r   r   r   r]  rU   r   rC   rD   rE   r0   rW   rL   rb  s       r3   test_chord_nodes_label_textz,TestMplChordPlot.test_chord_nodes_label_text  sb    JOOO00$Q''h'77777IIIIIr4   c                     | j                             d          }t          j        |          }|j        d         }|                     d |D             g d           d S )Nr   )rb  rb  c                 6    g | ]}|                                 S r8   rd  rf  s     r3   r>   zDTestMplChordPlot.test_chord_nodes_labels_mapping.<locals>.<listcomp>  rh  r4   ri  rj  rk  s       r3   test_chord_nodes_labels_mappingz0TestMplChordPlot.test_chord_nodes_labels_mapping  sb    JOO7O++$Q''h'77777IIIIIr4   c                 x   | j                             dg d          }t          j        |          }|j        d         }|j        d         }t          j        g dg dg dg          }|                     |                                |           |                     |	                                |           d S )	Nr   rd   z#CCCCCCre   rP   arcsr#   ri   )皙?rs  rs  rS   rj   )
r]  rU   r   rC   rD   r    rB   rE   rl   rV   )r0   rW   rL   rr  r#   rn   s         r3   *test_chord_nodes_categorically_colormappedz;TestMplChordPlot.test_chord_nodes_categorically_colormapped  s    JOO6W6W6WOXX$Q''|F#W%3333333335 6 6 	**F333--//88888r4   c                 v   | j                             dg d          }t          j        |          }|j        d         }|j        d         }|                     t          j        |                                          t          j	        g d                     |                     t          j        |                                          t          j	        g d                     |                     |
                                d           |                     |
                                d           d S )Nr   rq  )r{   rR   rr  r#   r   ru   )r]  rU   r   rC   rD   rE   r    rF   r\   rB   r]   )r0   rW   rL   rr  r#   s        r3   #test_chord_node_color_style_mappingz4TestMplChordPlot.test_chord_node_color_style_mapping  s    JOOw5V5V5VOWW$Q''|F#W%EOO$5$5668K8KLLLDNN$4$455rx			7J7JKKK))6222&11111r4   c                    | j                             dddg          }t          j        |          }|j        d         }t          j        g dg dg dg          }|                     |                                |           d S rb   )	r]  rU   r   rC   rD   r    rB   rE   r   rm   s        r3   *test_chord_edges_categorically_colormappedz;TestMplChordPlot.test_chord_edges_categorically_colormapped  s    JOOWI@VOWW$Q''W%---------/ 0 0 	--//88888r4   c                    | j                             t          d                              t                    ddg          }t          j        |          }|j        d         }|                     t          j
        |                                          t          j        g d                     |                     |                                d           d S )Nrc   rd   re   )r   rh   r6   rK  ru   )r]  rU   r   astypestrr   rC   rD   rE   r    rF   r\   rB   r]   rq   s       r3   #test_chord_edge_color_style_mappingz4TestMplChordPlot.test_chord_edge_color_style_mapping  s    JOOs7||':':3'?'?IW`KaObb$Q''W%EOO$5$5668K8KLLL))622222r4   c                    t          |                     d          |                     d          d                              dd          }t          j        |          }|j        d         }|                     t          j        |	                                          t          j
        g d                     |                     |                                d	           |                    d
           |                     t          j        |	                                          t          j
        g d                     |                     |                                d           d S )Nr   r   rt   r  Tr   r6   r.  r   r   )rv   r   r   )rv   r   r	   r_  rU   r   rC   rD   rE   r    rF   r\   rB   r]   r   r0   hmaprL   r6   s       r3   1test_chord_edge_color_linear_style_mapping_updatezBTestMplChordPlot.test_chord_edge_color_linear_style_mapping_update  s(   4??1--$//!2D2DEEFFKKW_koKpp$T**W%EOO$5$5668K8KLLL))6222DEOO$5$5668K8KLLL))622222r4   c                    t          |                     d          |                     d          d                              dd          }t          j        |          }|j        d         }|j        d         }|                     t          j        |	                                          t          j
        g d	                     |                     t          j        |	                                          t          j
        g d	                     |                     |                                d
           |                     |                                d
           |                    d           |                     t          j        |	                                          t          j
        g d                     |                     t          j        |	                                          t          j
        g d                     |                     |                                d           |                     |                                d           d S )Nr   r   rt   r   Tr   rr  r#   r   ru   r   r.  r   r~  )r0   r  rL   rr  r#   s        r3   1test_chord_node_color_linear_style_mapping_updatezBTestMplChordPlot.test_chord_node_color_linear_style_mapping_update!  s   4??1--$//!2D2DEEFFKKW^jnKoo$T**|F#W%EOO$5$5668K8KLLLDNN$4$455rx			7J7JKKK))6222&111DEOO$5$5668K8KLLLDNN$4$455rx			7J7JKKK))6222&11111r4   c           	      `   t          |                     d          |                     d          d                              t          d                              ddddd	          
          }t          j        |          }|j        d         }|                     |	                                t          j        g dg dg dg                     |                    d           |                     |	                                t          j        g dg dg dg                     d S )Nr   r   rt   r  r   r   r   r0  )r   rv   r   r   r   r6   r}   r1  r   r   r|   )r	   r_  rU   r   
categorizer   rC   rD   rE   r   r    rB   r   r  s       r3   *test_chord_edge_color_style_mapping_updatez;TestMplChordPlot.test_chord_edge_color_style_mapping_update0  sB   4??1--$//!2D2DEEFFKK8}}//Eg&U\0]0]^^ L 
 
 $T**W%--//LL---|||;
 2 2 	 	 	 	D--//|||;
 2 2 	 	 	 	 	r4   c           	      "   t          |                     d          |                     d          d                              t          d                              ddddd	          
          }t          j        |          }|j        d         }|j        d         }t          j	        g dg dg dg          }| 
                    |                                |           | 
                    |                                |           |                    d           t          j	        g dg dg dg          }| 
                    |                                |           | 
                    |                                |           d S )Nr   r   rt   r   r   r   r   r0  r6  rz   rr  r#   r}   r1  r   r   r|   )r	   r_  rU   r   r  r   rC   rD   r    rB   rE   r   rV   r   )r0   r  rL   rr  r#   rn   s         r3   *test_chord_node_color_style_mapping_updatez;TestMplChordPlot.test_chord_node_color_style_mapping_update>  s   4??1--$//!2D2DEEFFKK7||..5WT[/\/\]] L 
 
 $T**|F#W%LL---|||
   	,,..777--//888D|||
   	,,..777--//88888r4   )r  r  r	  r   r_  rl  ro  rt  rv  rx  r|  r  r  r  r  r
  r  s   @r3   rZ  rZ    s        5 5 5 5 55 5 5
J J JJ J J	9 	9 	92 2 29 9 93 3 33 3 32 2 2  9 9 9 9 9 9 9r4   rZ  )numpyr    r   matplotlib.collectionsr   r   packaging.versionr   holoviews.core.datar   holoviews.core.optionsr   r   holoviews.core.spacesr	   holoviews.elementr
   r   r   r   r   holoviews.util.transformr   	test_plotr   r   r   r  rZ  r8   r4   r3   <module>r     s        A A A A A A A A % % % % % % ' ' ' ' ' ' > > > > > > > > ) ) ) ) ) ) K K K K K K K K K K K K K K ( ( ( ( ( ( 0 0 0 0 0 0 0 0[B [B [B [B [B{ [B [B [B~g: g: g: g: g: g: g: g:Vv9 v9 v9 v9 v9{ v9 v9 v9 v9 v9r4   