在簇状条形图上手动绘制时,geom_signif()重叠星号/星号?

geom_signif() overlaps asterisks/stars when manually plotting on a cluster bar graph?

提问人:JLit98 提问时间:11/14/2023 最后编辑:JLit98 更新时间:11/15/2023 访问量:32

问:

我创建了一个包含星号和详细信息的数据帧,以在图表上显示统计信息:

#this is index_df dataframe
xmin xmax y   sym
0.8  1.2  4.5 *
0.8  1.8  5.5 ****
1.2  2.2  6.5 *
1.8  2.2  4.5 *

我通过 geom_signif() 将其应用于条形图(即绘图)

plot<- plot+geom_signif(
      data = index_df,
      aes(xmin=index_df$xmin_index,
          xmax=index_df$xmax_index,
          annotations=index_df$sym,
          y_position=index_df$y),
      textsize=6,size=0.7,vjust=0.5,manual=TRUE,inherit.aes = FALSE)}
  

输出如下:enter image description here

正如你所看到的,geom_signif当应该有三个单独的.**

我试过hjust,但没有用

r ggplot2 统计 注释 条形图

评论

0赞 IRTFM 11/14/2023
你的意思是“星号”,也就是 R 词汇中的“星星”吗?
0赞 JLit98 11/14/2023
@IRTFM,是的星号/星号。会改变
0赞 IRTFM 11/14/2023
我没有“看到”问题。
0赞 JLit98 11/15/2023
问题是应该有 3 个单独的单个星号/星号,每个深色和浅色组的每个列括号上方一个,然后在括号顶部有一个星号,连接每组的浅色阴影列。但是 geom_signif() 已将所有单个星号组合成一个星号,位于连接两个较浅的阴影列的支架顶部。

答:

0赞 JLit98 11/15/2023 #1

我已经通过使用库中的应用程序来修复它。geom_bracket()ggpubr

plot<- plot+geom_bracket(
      aes(xmin=index_df$xmin_index,
          xmax=index_df$xmax_index,
          label=index_df$sym,
          y.position=index_df$y),
      data=index_df,inherit.aes = FALSE)}