ggbarplot中缺少数据的空白区域

8yoxcaq7  于 2023-06-19  发布在  其他
关注(0)|答案(1)|浏览(161)

寻找一种方法来保持所有的酒吧相同的宽度,并留下一个空白的地方,数据丢失。有什么办法吗?

p = ggbarplot(avg_neighb_ct, x = "First.Object.cellType", y = "count", 
              fill = "data", merge = TRUE, add = "mean_se", width = 0.75) + 
  theme_classic() + 
  theme(axis.title.x = element_blank(),
        axis.title.y = element_text(size = 20),
        axis.text.x = element_text(size = 20, angle = 90, hjust = 1),
        axis.text.y = element_text(size = 20),
        legend.title = element_blank(),
        legend.text = element_text(size = 16)) +
  ylab("Count")
p

    • 编辑**

已添加
position = position_dodge2(preserve = "single")
现在我的误差线被关掉了

uttx8gqw

uttx8gqw1#

position = position_dodge(preserve = "single")添加到对ggbarplot的调用中
在没有可重现问题的情况下,从软件包文档中改编的示例证明了这一点:

library(ggpubr)

df3 <- ToothGrowth[!(ToothGrowth$dose == 1 & ToothGrowth$sup == "VC"), ]

ggbarplot(df3, x = "dose", y = "len", color = "supp",
          add = "mean_se", palette = c("#00AFBB", "#E7B800"),
          position = position_dodge(preserve = "single"))

创建于2023-06-13带有reprex v2.0.2

相关问题