I have a data frame that looks like this. It contains the sunflower seed productivity of each country. I want to add next to this data polygon data so I can plot it with ggplot2.
I was told to use this site: https://observablehq.com/@ladataviz/wip-voronoi-data-generator, I want to understand how I can create polygons and plot a circular voronoi diagram.
I have created a similar post in the past, but my question here is very different. I want to find a way to create the polygon data
df <- data.frame(country = c("Ukraine", "Russia", "Argentina", "China", "Romania", "Other"),
prod = c(11.0, 10.6, 3.1, 2.4, 2.1, 15.3))
df
#> country prod
#> 1 Ukraine 11.0
#> 2 Russia 10.6
#> 3 Argentina 3.1
#> 4 China 2.4
#> 5 Romania 2.1
#> 6 Other 15.3
Created on 2023-01-20 with reprex v2.0.2
If add polygons to my data should look like this:
x y path split group value
1 472.0117 220.08122253 0 Ukraine Ukraine 11
2 471.8336 217.18476868 1 Ukraine Ukraine 11
3 471.6556 214.28833008 2 Ukraine Ukraine 11
4 471.4776 211.39187622 3 Ukraine Ukraine 11
5 471.2996 208.49542236 4 Ukraine Ukraine 11
6 471.1216 205.59896851 5 Ukraine Ukraine 11
I want my data to look like this.