I'm trying to replicate this plot, particularly the spiral bar chart for INDUSTRIAL. Any idea how to do this using ggplot2?
Thanks in advance!
CodePudding user response:
The actual code for this is quite straightforward using geomtextpath. It's getting the data in the right format that is difficult:
library(geomtextpath)
df <- data.frame(
Domain = rep(c("BUSINESS", "CLASSICAL", "PROFESSIONAL",
"SCIENTIFIC", "NORMAL", "INDUSTRIAL"),
times = c(2, 2, 2, 2, 2, 202)),
x = c(0, 112, 0, 198, 0, 252, 0, 281, 0, 483, 0,
800 100 * sin(seq(0, pi, length = 100)),
100 - 100 * sin(seq(0, pi, length = 100)), 400),
y = c(8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3,
2.5 0.5 * cos(seq(0, pi, length = 100)),
1.5 0.5 * cos(seq(0, pi, length = 100)), 1)
)
ggplot(df, aes(x, y))
geom_textpath(aes(label = Domain),
colour = "#907f6e", hjust = 0, linewidth = 5)
theme_void()
theme(plot.background = element_rect(fill = "#d3c2b2"))