# color list colorList = [] for regionIndex inrange(len(vor.regions)): ifnot -1in vor.regions[regionIndex]: polygon = [vor.vertices[i] for i in vor.regions[regionIndex]] iflen(polygon) == 0: colorList += colorList[-1:] continue colorList += [np.array(polygon).transpose().min()] colorList += colorList[-1:] colorList = normalizer(np.array(colorList))
# colorize for regionIndex inrange(len(vor.regions)): ifnot -1in vor.regions[regionIndex]: polygon = [vor.vertices[i] for i in vor.regions[regionIndex]] plt.fill(*zip(*polygon),color=np.repeat(colorList[regionIndex],3))
# fix the range of axes plt.xlim([-0.2,1.2]), plt.ylim([-0.2,1.2])