【问题标题】:How to remove the empty space that is created with ggpubr stat_pvalue_manual hide.ns = true?如何删除使用 ggpubr stat_pvalue_manual hide.ns = true 创建的空白空间?
【发布时间】:2022-06-21 17:36:04
【问题描述】:

当调用pubr的stat_pvalue_manual函数时:

ggplot + stat_pvalue_manual(statistics, label = "p.adj.signif", 
                 coord.flip = TRUE,
                 #hide.ns = TRUE, 
                 tip.length = 0,
                 bracket.size = 0)+coord_flip()

生成如下图:

然而,人们只对重要的数据感兴趣,因此通过调用 hide.ns = TRUE 来省略 ns 数据,如下所示:

ggplot + stat_pvalue_manual(statistics, label = "p.adj.signif", 
                 coord.flip = TRUE,
                 hide.ns = TRUE, 
                 tip.length = 0,
                 bracket.size = 0)+coord_flip()

这会在ns数据之前占用的地方创建空白空间,有没有办法删除它?

要计算 xy 位置,在统计对象中按如下方式完成:

statistics <- dataframe %>%
tukey_hsd(value~group) %>%
add_xy_position(fun = "mean_se", x= "group")

提前致谢!

【问题讨论】:

标签: r ggplot2 ggpubr rstatix


【解决方案1】:

我通过过滤统计表以仅显示重要值来做到这一点。

    statistics <- statistics %>%
        filter(p.adj.signif != "ns")

    ggplot + stat.pvalue_manual(statistics, label = "p.adj.signif")

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-05
    • 2013-11-20
    • 1970-01-01
    • 2015-04-09
    • 1970-01-01
    • 2022-01-17
    相关资源
    最近更新 更多