【发布时间】:2020-09-07 11:32:59
【问题描述】:
我有以下数据集:
data <- structure(list(Q14 = c("< 5 people", "> 11 people", "6-10 people",
NA), count = c(148L, 13L, 34L, 21L), var = c("Team Size", "Team Size",
"Team Size", "Team Size")), row.names = c(NA, -4L), class = c("tbl_df",
"tbl", "data.frame"))
我将 geom_bar 绘制如下:
library(ggplot2)
library(wesanderson)
ggplot(data) +
geom_bar( aes(x = var, y = count, fill = Q14), stat = "identity", position = "fill") +
coord_flip() +
theme(legend.position = "none",
axis.title.x=element_blank(), axis.title.y=element_blank()) +
scale_fill_manual(values = wes_palette("Zissou1", 3, type = "continuous"))
我想打印条内的标签,如下。注意:我的编辑技术很烂,我当然希望标签是对齐的,它们也可以逆时针旋转。
另一种选择是获得以下内容,我也很喜欢:
【问题讨论】: