创建一个特殊的径向条形图(赛道图)

Create a special Radial bar chart (race track plot)

我能够在这里复制另一个好的答案来创建一个基本的径向图,但是任何人都可以给我其他人的任何线索 functions/parameters/ideas 关于如何将基本的转换成类似于这样的东西:

你可以像这样接近:

df <- data.frame(x = c(10, 12.5, 15), y = c(1:3),
                 col = c("#fcfbfc", "#fbc3a0", "#ec6f4a"))

library(ggplot2)

ggplot(df, aes(x = 0, xend = x, y = y, yend = y, color = col)) +
  geom_hline(yintercept = c(1:3), size = 14, color = "#dfdfdf") +
  geom_hline(yintercept = c(1:3), size = 13, color = "#f7f7f7") +
  geom_segment(color = "#bf2c23", size = 14, lineend = 'round') +
  geom_segment(size = 13, lineend = 'round') +
  scale_color_identity() +
  geom_point(aes(x = x - 0.03 * y), size = 5, color = "#bf2c23", 
             shape = 21, fill = 'white') +
  geom_point(aes(x = x - 0.03 * y), size = 2, color = "#bf2c23", 
             shape = 21, fill = 'white') +
  scale_y_continuous(limits = c(0, 4)) +
  scale_x_continuous(limits = c(0, 20)) +
  coord_polar() +
  theme_void()

这是一个开始。您是否尝试复制某些特定方面?这是一种相当定制化的格式。

df <- data.frame(type = c("on", "ia", "n"),
                 radius = c(2,3,4),
                 value = c(10,21,22))

library(ggplot2); library(ggforce)
ggplot(df) +
  geom_link(aes(x = radius, xend = radius,
                y = 0, yend = value), 
            size = 17, lineend = "round", color = "#bb353c") +
  geom_link(aes(x = radius, xend = radius,
                y = 0, yend = value, color = type), 
            size = 16, lineend = "round") +
  geom_label(aes(radius, y = 30, 
                 label = paste(type, ": ", value)), hjust = 1.8) +
  scale_x_continuous(limits = c(0,4)) +
  scale_y_continuous(limits = c(0, 30)) +
  scale_color_manual(values = c("on" = "#fff7f2", 
                                "ia" = "#f8b68f", 
                                "n" = "#e4593a")) +
  guides(color = "none") +
  coord_polar(theta = "y") + 
  theme_void()