當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python SciPy spatial.delaunay_plot_2d用法及代碼示例

本文簡要介紹 python 語言中 scipy.spatial.delaunay_plot_2d 的用法。

用法:

scipy.spatial.delaunay_plot_2d(tri, ax=None)#

在二維中繪製給定的 Delaunay 三角剖分

參數

tri scipy.spatial.Delaunay 實例

三角剖分繪圖

ax matplotlib.axes.Axes 實例,可選

要繪製的軸

返回

fig matplotlib.figure.Figure 實例

圖的圖

注意

需要 Matplotlib。

例子

>>> import numpy as np
>>> import matplotlib.pyplot as plt
>>> from scipy.spatial import Delaunay, delaunay_plot_2d

一組隨機點的 Delaunay 三角剖分:

>>> rng = np.random.default_rng()
>>> points = rng.random((30, 2))
>>> tri = Delaunay(points)

繪製它:

>>> _ = delaunay_plot_2d(tri)
>>> plt.show()
scipy-spatial-delaunay_plot_2d-1.png

相關用法


注:本文由純淨天空篩選整理自scipy.org大神的英文原創作品 scipy.spatial.delaunay_plot_2d。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。