scipy.spatial.convex_hull_plot_2d#

scipy.spatial.convex_hull_plot_2d(hull, ax=None)[source]#

Plot the given convex hull diagram in 2-D

Parameters
hullscipy.spatial.ConvexHull instance

Convex hull to plot

axmatplotlib.axes.Axes instance, optional

Axes to plot on

Returns
figmatplotlib.figure.Figure instance

Figure for the plot

See also

ConvexHull

Notes

Requires Matplotlib.

Examples

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