是否可以在R中绘制下图?

Is it possible to draw the following diagram in R?

想请问有没有R包可以画下图?

我有百分比形式的数据,但不知道如何绘制这样的图表。

谢谢!

我想如果您将数据转换成这种格式:

df <- data.frame(percents = c(51, 48, 46, 41, 29, 25, 34, 18, 18),
                 label = c("MEDICAL\nSCHOOL\nAPPLICANTS", 
                           "MEDICAL\nSCHOOL\nGRADUATES", 
                           "RESIDENTS", 
                           "FACULTY", 
                           "DIVISION\nCHIEFS", 
                           "FULL\nPROFESSORS", 
                           "SENIOR\nASSOCIATE\nDEANS", 
                           "DEPARTMENT\nCHAIRS", "DEANS"))
df
#>   percents                       label
#> 1       51 MEDICAL\nSCHOOL\nAPPLICANTS
#> 2       48  MEDICAL\nSCHOOL\nGRADUATES
#> 3       46                   RESIDENTS
#> 4       41                     FACULTY
#> 5       29            DIVISION\nCHIEFS
#> 6       25            FULL\nPROFESSORS
#> 7       34    SENIOR\nASSOCIATE\nDEANS
#> 8       18          DEPARTMENT\nCHAIRS
#> 9       18                       DEANS

然后你可以这样做:

library(ggplot2)
library(ggforce)
library(dplyr)

df %>% mutate(r = sqrt(percents), x = r + cumsum(lag(2 * r, default = 0))) %>%
  ggplot() + 
  geom_circle(aes(x0 = x, r = r, y0 = r), size = 3, color = "#0A0A0A5A") +
  geom_text(aes(x = x, y = r, label = paste0(percents, "%"), size = percents),
            fontface = "bold", color = "#643291") +
  geom_text(aes(x = x, y = 20, label = label), vjust = 0,
            fontface = "bold", color = "gray20", size = 3) +
  geom_segment(aes(x = x, xend = x, y = r + 3, yend = 18),
               color = "#643291", size = 2) +
  coord_equal() +
  scale_y_continuous(limits =c(-5, 25)) +
  scale_size_continuous(range = c(4, 8)) +
  theme_void() +
  theme(legend.position = "none")

请注意,百分比与圆圈的 面积 成正比,这是在此类图中表示数据的更诚实的方式。