In [31]:
import numpy as np
from scipy.spatial import Delaunay
from scipy.spatial import ConvexHull
import matplotlib.pyplot as plt
%matplotlib inline
import plotly.offline as py
import plotly.graph_objs as go
py.init_notebook_mode()
In [27]:
points = np.array([[0, 0], [0, 1.1], [1, 0], [1, 1], [0.5, 0.5]])
tri = Delaunay(points)
plt.triplot(points[:,0], points[:,1], tri.simplices.copy())
plt.plot(points[:,0], points[:,1], 'o')
Out[27]:
In [32]:
print tri.simplices
In [38]:
hull = ConvexHull(points)
for s in hull.simplices:
plt.plot(points[s,0], points[s,1])
In [ ]: