使用 ggplot2 绘制螺旋条形图

Pab*_*oAB 1 r ggplot2

我正在尝试复制此图,特别是INDUSTRIAL的螺旋条形图。知道如何使用 ggplot2 来做到这一点吗? 在此输入图像描述

提前致谢!

All*_*ron 8

使用 geomtextpath 的实际代码非常简单。以正确的格式获取数据很困难:

library(geomtextpath)

df <- data.frame(
  Domain = rep(c("BUSINESS  12", "CLASSICAL  98", "PROFESSIONAL  152",
                 "SCIENTIFIC  161", "NORMAL  383", "INDUSTRIAL  2252"),
               times = c(2, 2, 2, 2, 2, 202)),
  x = c(0, 212, 0, 298, 0, 410, 0, 381, 0, 583, 0,
        800 + 80 * sin(seq(0, pi, length = 100)), 
        80 - 80 * sin(seq(0, pi, length = 100)), 400),
  y = c(8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 
        2.6 + 0.4 * cos(seq(0, pi, length = 100)), 
        1.8 + 0.4 * cos(seq(0, pi, length = 100)), 1.4)
)

ggplot(df, aes(x, y)) + 
  geom_textpath(aes(label = Domain), size = 3,
                colour = "#907f6e", hjust = 0, linewidth = 3.8) + 
  theme_void() + 
  theme(plot.background = element_rect(
    fill = radialGradient(c("#d8cabe", "#ccb5a1"))),
    plot.margin = margin(50, 10, 50, 10))
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述