我创建了一个数据框,其中包含星号和详细信息以在图表上显示统计信息:
#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)}
正如您所看到的,geom_signif() 已经重叠了
*
,而应该有三个单独的 *
。
我尝试过hjust,但没有成功
我已经通过使用
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)}