我有一个数据框,长这样,我想用它创建一个圆形 Voronoi 图。
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
本示例由 reprex package(v2.0.1)于2022年04月08日创建。
library(ggplot2)
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
library("ggvoronoi")
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))
ggplot(df, aes(country, prod)) +
geom_voronoi(aes(fill=prod)) +
theme_minimal()
此代码是由reprex package (v2.0.1)于2022-04-08创建的
请问有什么方法可以制作圆形的图案吗? 我找到了这个github链接,但它缺少我需要将多边形转换为圆形voronoi所需的数据 https://github.com/nrennie/30DayChartChallenge/blob/main/2022/scripts/04_flora.R