如何使用geom_signif(ggsignif,R)更改字体和括号大小?

如何使用geom_signif(ggsignif,R)更改字体和括号大小?,r,ggplot2,significance,R,Ggplot2,Significance,我试图用ggplot2绘制数据,并用ggsignif显示成对统计比较。ggsignif批注的字体太小,线宽太细。帮助说明textsize和size参数应分别更改字体大小和括号厚度,但是,这些参数对我不起作用。我已尝试在theme()中调整文本大小并设置基本大小。所有其他文本都是响应性的。我正在使用我认为是最新版本的东西(Rv3.6.1,GGSIGNIFV0.6.0) 我不确定它是否相关,但我还发现geom_signif()错放了注释(例如“*”),但正确放置了比较括号。每当我在一个geom_si

我试图用ggplot2绘制数据,并用ggsignif显示成对统计比较。ggsignif批注的字体太小,线宽太细。帮助说明textsizesize参数应分别更改字体大小和括号厚度,但是,这些参数对我不起作用。我已尝试在theme()中调整文本大小并设置基本大小。所有其他文本都是响应性的。我正在使用我认为是最新版本的东西(Rv3.6.1,GGSIGNIFV0.6.0)

我不确定它是否相关,但我还发现geom_signif()错放了注释(例如“*”),但正确放置了比较括号。每当我在一个geom_signif()中添加多个比较时,就会发生这种情况。如果我添加了多个geom_signif(),每个都有一个对比较(参见下面的代码),那么我就不会遇到这个问题。即使我只添加了一个geom_signif(),也不会影响textsize/size问题

p = ggplot(population, aes(x=Cluster, y=Cells)) +
  geom_jitter(aes(colour=Sample), position=position_jitterdodge(jitter.width=0.3, dodge.width=0.7), size=1, alpha=0.1) +
  geom_point(data=population.sum, aes(y=Cells, fill=Sample), size=10, position=position_dodge(0.7)) +
  geom_errorbar(data=population.sum, aes(fill=Sample, ymin=CI.Lower, ymax=CI.Upper), width=0.2, size=2, position=position_dodge(0.7)) +
  scale_y_continuous(limits=c(0,1200), expand=c(0, 0)) +
  scale_color_brewer(palette="Paired") +
  theme_classic(base_size = 60) +
  theme(
    legend.justification=c(0, 1),
    legend.position=c(0.01, 1),
    legend.title=element_blank(),
    axis.text.x=element_text(angle=45, hjust=1),
    axis.title.x=element_blank(),
    plot.margin=unit(c(25.5,5.5,5.5,5.5),"pt")
  )

for (i in seq_along(cluster.levels)) # Shouldn't have to add individually?
  p = p + geom_signif(
    stat="identity",
    data=population.sig[i,],
    size=10, # This doesn't work!
    textsize=200, # This doesn't work!
    aes(x=x.start, xend=x.end, y=y, yend=y, annotation=Annotation)
  )

png("Population Scatter Plot.png", 4500, 3000)
p
dev.off()
数据集包括:

总体单个数据点。30k条记录(每个集群*样本1k)。栏目:

  • 簇(因子):图形列的组
  • 样本(因子):图形列组中成对的个体
  • 单元格(int):绘制的暗点
人口。总和汇总数据。30条记录(每个群集*样本1条)。栏目:

  • 集群(因子):如上所述
  • 样本(系数):如上所述
  • 单元格(int):绘制的大黑点
  • CI.Lower(num):绘制的错误条的较低范围
  • CI.Upper(num):绘制的错误条的上限
population.sig设置显著性括号的数据格式。15条记录(每组1条)。栏目:

  • x、 开始(num):比较括号的左侧范围
  • x、 结束(num):比较括号的右侧范围
  • y(num):比较括号的垂直位置
  • 注释(chr):要注释的文本(“*”或“NS”)

我还没有解决这个问题,但我已经使用geom_segment()和geom_text()解决了这个问题(有效地代替了for循环):


我遇到了同样的问题。奇怪的是,当我移动geom_signif的aes()中的textsize函数时,问题就解决了

对于您的情况,请尝试以下代码:

    geom_signif(
    stat="identity",
    data=population.sig[i,],
    #size=10, 
    #textsize=200, 
    aes(x=x.start, xend=x.end, y=y, yend=y, annotation=Annotation,size=10,textsize=200)
    geom_signif(
    stat="identity",
    data=population.sig[i,],
    #size=10, 
    #textsize=200, 
    aes(x=x.start, xend=x.end, y=y, yend=y, annotation=Annotation,size=10,textsize=200)