ridge_vertices:
ridge_vertices (list of list of ints, shape (nridges, *))
Indices of the Voronoi vertices forming each Voronoi ridge.
.
vertices. , ,
. -1 , .
script, :
import numpy as np
import matplotlib.pyplot as plt
from scipy.spatial import Voronoi
points = np.array([[0, 0], [0, 1], [0, 2],
[1, 0], [1, 1], [1, 2],
[2, 0], [2, 1], [2, 2]])
vor = Voronoi(points)
fig = plt.figure()
plt.hold(True)
plt.plot(vor.vertices[:,0], vor.vertices[:, 1], 'ko', ms=8)
for vpair in vor.ridge_vertices:
if vpair[0] >= 0 and vpair[1] >= 0:
v0 = vor.vertices[vpair[0]]
v1 = vor.vertices[vpair[1]]
plt.plot([v0[0], v1[0]], [v0[1], v1[1]], 'k', linewidth=2)
plt.show()
:
