In [ ]:
import numpy as np
from scipy.spatial import ConvexHull
points = np.random.rand(30, 2) # 30 random points in 2-D
hull = ConvexHull(points)
In [ ]:
from bokeh.io import output_notebook
from bokeh.plotting import figure, show # this _may_ have already been imported above
In [ ]:
output_notebook() # again, this may have been called already
In [ ]:
f = figure()
In [ ]:
f.circle(points[:,0],points[:,1], color='red')
In [ ]:
# Warning! Loop ahead!
for simplex in hull.simplices:
f.line(points[simplex, 0], points[simplex, 1])
In [ ]:
show(f)
In [ ]: