20220518_ggplot2绘制玫瑰图
代码语言:javascript复制library(ggplot2)
library(cowplot)
library(ggsci)
dt = data.frame(A = c(281,384,135,58,77, 89), B = c('ZT2','ZT6','ZT10','ZT14','ZT18','ZT22'))
dt$B <- factor(dt$B, levels = c('ZT2','ZT6','ZT10','ZT14','ZT18','ZT22'))
windowsFonts(myFont = windowsFont("楷体")) ## 绑定字体
ggplot(dt, aes(x = B, y = A, fill = B))
theme_bw()
geom_bar(stat = "identity", alpha = 0.7)
coord_polar()
ggplot(dt, aes(x = B, y = A))
theme_minimal(base_family = "",base_line_size = 1.2 )
geom_bar(stat = "identity", alpha = 0.8,fill = "#89CDBF")
coord_polar(theta = "x")
注意:
玫瑰图与雷达图非常相似做好区别