Say I have the following data:
mydf <- data.frame("x_coords"=c(17,51,28,34,12), "y_coords"=c(5,19,21,6,50))
I want to create a voronoi diagram from these data points, and furthermore retrieve coordinate information about each cell. From the ggvoronoi
package on CRAN, I call the following functions:
vor_spdf <- voronoi_polygon(data=mydf ,x="x_coords",y="y_coords")
vor_df <- fortify_voronoi(vor_spdf)
Now, vor_df
provides me with the coordinates bounding the areas of each cell. In the image of the voronoi plot below, say I wanted to find the area each voronoi cell contributes to the region encapsulated within the red rectangle.
In summary, I want to find the areas of the regions I've denoted as 1, 2, and 3. How would I go about doing this in R?