scipy.spatial.
convex_hull_plot_2d#
- scipy.spatial.convex_hull_plot_2d(hull, ax=None)[源代码]#
在二维图中绘制给定的凸包图
- 参数:
- hullscipy.spatial.ConvexHull 实例
要绘制的凸包
- axmatplotlib.axes.Axes 实例,可选
要绘制的轴
- 返回:
- figmatplotlib.figure.Figure 实例
绘图的图形
另请参阅
注释
需要 Matplotlib。
示例
>>> import numpy as np >>> import matplotlib.pyplot as plt >>> from scipy.spatial import ConvexHull, convex_hull_plot_2d
随机点集的凸包
>>> rng = np.random.default_rng() >>> points = rng.random((30, 2)) >>> hull = ConvexHull(points)
绘制它
>>> _ = convex_hull_plot_2d(hull) >>> plt.show()