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]:
[<matplotlib.lines.Line2D at 0x7f1b62c44ed0>]

In [32]:
print tri.simplices


[[2 4 0]
 [4 1 0]
 [3 4 2]
 [4 3 1]]

In [38]:
hull = ConvexHull(points)

for s in hull.simplices:
    plt.plot(points[s,0], points[s,1])



In [ ]: