scipy.spatial.

convex_hull_plot_2d#

scipy.spatial.convex_hull_plot_2d(hull, ax=None)[源代码][源代码]#

在二维平面上绘制给定的凸包图

参数:
船体scipy.spatial.ConvexHull 实例

凸包绘图

axmatplotlib.axes.Axes 实例,可选

要绘制的轴

返回:
matplotlib.figure.Figure 实例

图表用于绘图

参见

ConvexHull

注释

需要 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()
../../_images/scipy-spatial-convex_hull_plot_2d-1.png