ggrorplot 中的分组错误

grouping mistake in ggerrorplot

我在使用 ggrorplot 函数的 facet.by 参数时遇到问题。当我使用分组变量时,构面仍显示两组中的所有数据标签,但带有空格。有没有办法擦除多余的标签,或者在 ggplot 中重新创建它?谢谢!

ggerrorplot(aile_data, x = "lignee", y = "longueur",
            desc_stat = "mean_ci", ci = 0.95, color = "black",
            add = "jitter", add.params = list(color = "darkgray"), facet.by = "type")

尚未在文档中找到选项,但您可以通过手动添加 facet_wrap.

来释放天平

使用 ggpubr::ggerrorplot 中的默认示例:

library(ggpubr)
#> Loading required package: ggplot2

df<- ToothGrowth

# Plot mean_se
p <- ggerrorplot(df, x = "dose", y = "len", facet.by = "dose")

p

p + facet_wrap(~dose, scales = "free_x")