0

I am working on a visualization for voronoi regions in python. Using a mesh of 110x110 points in a 10x10 plane I have obtained the voronoi regions. In the plot you can see all the points plotted with a different color to indicate the different regions (the location of the robot/agent is not shown in the plot but they are somewhere in each region). What I want to get is instead of a bunch of filled-in regions, just the boundary lines of the regions. This way I can show a heat map of a probability density function in the background which is necessary for the visualization. How do I plot these borders/boundary lines from each region's mesh?

Filled in regions:

"Filled in regions"

I have tried to use scipy.spatial convexhull but this resulted in a line that zig-zags through the regions, and does not go around the mesh of points of the regions.

Using scipy.spatial convexhull:

Using scipy.spatial convexhull

for i in range(len(voronois)):
    hull = ConvexHull(voronois[i].grid_coordinates)
    plt.plot(voronois[i].grid_coordinates[:, 0], voronois[i].grid_coordinates[:, 1], 'o')
    for simplex in hull.simplices:
        plt.plot(voronois[i].grid_coordinates[simplex, 0], voronois[i].grid_coordinates[simplex, 1], 'k-')
    plt.show()
plt.show()
Michael M.
  • 10,486
  • 9
  • 18
  • 34
  • This link has some `contour`... https://matplotlib.org/stable/gallery/index.html#images-contours-and-fields – Joao_PS May 15 '23 at 01:48

0 Answers0