【发布时间】:2018-06-13 11:43:00
【问题描述】:
给出以下数据:
data2 <- list(structure(list(super_group = c(1,1), Group.1 = structure(3:4, .Label = c("A","B", "C", "D", "E", "F"), class = "factor"), Pr1 = c(65, 75), Pr2 = c(54, 88), Prh = c(25, 5), SE = c(25, 75 )), row.names = c(NA, -2L), class = "data.frame"), NULL, structure(list(super_group = c(3,3), Group.1 = structure(3:4, .Label = c("A","B", "C", "D", "E", "F"), class = "factor"), Pr1 = c(81,4), Pr2 = c(66, 57),Prh = c(3,3), SE = c(8, 9)), row.names = c(NA,
-2L), class = "data.frame"))
使用 ggplot2 绘图:
data2 %>%
bind_rows() %>%
ggplot(., aes(x = Group.1, y = Pr1, fill = Group.1)) +
geom_bar(stat = "identity") +
facet_grid(. ~ super_group)
-您在 x 轴上看到 C 和 D 标签,这是不必要的。所以我想删除它们并减小条的宽度。有什么想法吗?
-我们可以将 1 和 3 从 x 轴顶部移动到 x 轴底部吗?
【问题讨论】: