L inddlZddlmZgdZed dZdZed dZed dZ ed dZ y) N) decorator)delaunay_plot_2dconvex_hull_plot_2dvoronoi_plot_2dc 0ddlm}|+|j}|j}||fd|i|St |dd}|r ||fd|i|S |j d||fd|i||j |S#|j |wxYw)Nraxisholdcy)NTr ^/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/scipy/spatial/_plotutils.pyz_held_figure..sr T)matplotlib.pyplotpyplotfiguregcagetattrhold)funcobjrkwpltfigwas_helds r _held_figurers# zjjl WWYC%B%"%%3wr8\24HC%B%"%%  C%B%"% s BBcdtj|dz}|jd|z }|jd|z}|j |d|d|j |d|dy)Ng?raxis)npptpminmaxset_xlimset_ylim)rpointsmarginxy_minxy_maxs r _adjust_boundsr*sm 266&q) )F ZZQZ & (F ZZQZ & (FKKq 6!9%KKq 6!9%r cB|jjddk7r td|jj\}}|j ||d|j |||j jt||j|jS)aB Plot the given Delaunay triangulation in 2-D Parameters ---------- tri : scipy.spatial.Delaunay instance Triangulation to plot ax : matplotlib.axes.Axes instance, optional Axes to plot on Returns ------- fig : matplotlib.figure.Figure instance Figure for the plot See Also -------- Delaunay matplotlib.pyplot.triplot Notes ----- Requires Matplotlib. Examples -------- >>> import numpy as np >>> import matplotlib.pyplot as plt >>> from scipy.spatial import Delaunay, delaunay_plot_2d The Delaunay triangulation of a set of random points: >>> rng = np.random.default_rng() >>> points = rng.random((30, 2)) >>> tri = Delaunay(points) Plot it: >>> _ = delaunay_plot_2d(tri) >>> plt.show() rz!Delaunay triangulation is not 2-Do) r&shape ValueErrorTplottriplot simplicescopyr*r)trirxys r rr$s~Z zza<== ::<>> import numpy as np >>> import matplotlib.pyplot as plt >>> from scipy.spatial import ConvexHull, convex_hull_plot_2d The convex hull of a random set of points: >>> rng = np.random.default_rng() >>> points = rng.random((30, 2)) >>> hull = ConvexHull(points) Plot it: >>> _ = convex_hull_plot_2d(hull) >>> plt.show() rLineCollectionrr,zConvex hull is not 2-DNr-ksolid)colors linestyle) matplotlib.collectionsr:r&r.r/r1r3add_collectionr*r)hullrr:simplex line_segmentss r rr]sZ6 {{q 122GGDKK1 t{{1a40#69=HgT[[)HMHn],//6892t{{# 99 Is1Cc ddlm}|jjddk7r t d|j ddrI|j dd }|j |jd d df|jd d dfd | |j d dr5|j |jd d df|jd d dfd |j dd}|j dd}|j dd}|jjd}tj|jd} g} g} t|j|jD]\} } tj| } tj| dk\r| j!|j| S| | dk\d}|j| d|j| dz }|tj"j%|z}tj&|d |dg}|j| jd}tj(tj*||z ||z}|j,r| }t/| j1| j3z }|j||| j1z|zz}| j!|j||g|j5|| |||d|j5|| |||dt7||j|j8S)ae Plot the given Voronoi diagram in 2-D Parameters ---------- vor : scipy.spatial.Voronoi instance Diagram to plot ax : matplotlib.axes.Axes instance, optional Axes to plot on show_points : bool, optional Add the Voronoi points to the plot. show_vertices : bool, optional Add the Voronoi vertices to the plot. line_colors : string, optional Specifies the line color for polygon boundaries line_width : float, optional Specifies the line width for polygon boundaries line_alpha : float, optional Specifies the line alpha for polygon boundaries point_size : float, optional Specifies the size of points Returns ------- fig : matplotlib.figure.Figure instance Figure for the plot See Also -------- Voronoi Notes ----- Requires Matplotlib. For degenerate input, including collinearity and other violations of general position, it may be preferable to calculate the Voronoi diagram with Qhull options ``QJ`` for random joggling, or ``Qt`` to enforce triangulated output. Otherwise, some Voronoi regions may not be visible. Examples -------- >>> import numpy as np >>> import matplotlib.pyplot as plt >>> from scipy.spatial import Voronoi, voronoi_plot_2d Create a set of points for the example: >>> rng = np.random.default_rng() >>> points = rng.random((10,2)) Generate the Voronoi diagram for the points: >>> vor = Voronoi(points) Use `voronoi_plot_2d` to plot the diagram: >>> fig = voronoi_plot_2d(vor) Use `voronoi_plot_2d` to plot the diagram again, with some settings customized: >>> fig = voronoi_plot_2d(vor, show_vertices=False, line_colors='orange', ... line_width=2, line_alpha=0.6, point_size=2) >>> plt.show() rr9rr,zVoronoi diagram is not 2-D show_pointsT point_sizeN.) markersize show_verticesr- line_colorsr; line_widthg? line_alpharr<)r=lwalphar>dashed)r?r:r&r.r/getr1verticesmeanr r!zip ridge_pointsridge_verticesasarrayallappendlinalgnormarraysigndot furthest_siteabsr#r"r@r*r)vorrrr:rFrJrKrLcenter ptp_boundfinite_segmentsinfinite_segmentspointidxrBitnmidpoint direction aspect_factor far_points r rrsH6 zza566 vvmT"VVL$/   1a4 #**QT"2CJO vvot$  QT"CLLA$6<&&,K c*J c*J ZZ__!_ $Fszz*IO !1!133E3EFC'**W% 66'Q,   " "3<<#8 91 %a(A 8A;'#**Xa[*AAA " "A1Q4%1'Azz(+00a08Hx&'8! <=AI!!&J  )--/ ABM Q)immo*E *UUI  $ $cll1oy%A B%C(n_,7(2+5/6 89 n%6,7(2+5/7 9: 2szz" 99r )N) numpyr scipy._lib.decoratorr _decorator__all__rr*rrrr r r rqsi8 H  (&55p88vxxr