@_held_figure
def convex_hull_plot_2d(hull, ax=None):
 from matplotlib.collections import LineCollection
 if (hull.points.shape[1] != 2):
  raise ValueError('Convex hull is not 2-D')
 ax.plot(hull.points[:, 0], hull.points[:, 1], 'o')
 line_segments = []
 for simplex in hull.simplices:
  line_segments.append([(x, y) for (x, y) in hull.points[simplex]])
 ax.add_collection(LineCollection(line_segments, colors='k', linestyle='solid'))
 _adjust_bounds(ax, hull.points)
 return ax.figure

@ _held_figure def convex_hull_plot_2d ( hull , ax = None ) : from matplotlib . collections import LineCollection if ( hull . points . shape [ 1 ] != 2 ) : raise ValueError ( 'Convex hull is not 2-D' ) ax . plot ( hull . points [ : , 0 ] , hull . points [ : , 1 ] , 'o' ) line_segments = [ ] for simplex in hull . simplices : line_segments . append ( [ ( x , y ) for ( x , y ) in hull . points [ simplex ] ] ) ax . add_collection ( LineCollection ( line_segments , colors = 'k' , linestyle = 'solid' ) ) _adjust_bounds ( ax , hull . points ) return ax . figure
plot the given convex hull diagram in 2-d parameters hull : scipy .