java 注解 分组_在ggplot中注释分组的boxplot - 在boxplot下面添加观察数量

我想在每个箱图下面添加观察数量(如图所示 - 不需要红色方块) . :)但是,我不知道如何注释这种类型的boxplot(见下图) . multiple boxplot annotate number of observations

有谁知道怎么做?

这是我用来绘制这个数字的代码 .

ggplot(data=MIOT1, aes(stage, time, fill=resp)) +

geom_boxplot(color= "black", lwd=0.3) +

stat_summary(fun.y=mean, geom="point", shape=0, size=1, colour="black", position=position_dodge(width=0.75)) +

scale_fill_manual(values=c("grey25", "grey50", "grey67")) +

annotation_custom(mygrobA) +

scale_y_continuous(limits=c(-10,124)) +

theme(panel.grid.major = element_blank(),

panel.grid.minor = element_blank(),

strip.background = element_rect(colour="black"),

panel.border = element_rect(colour = "black", fill="transparent")) +

xlab(bquote(' ')) +

ylab(bquote('Minimum Consecutive Time (s)')) +

labs(title="SATIATION\n") +

theme(axis.title.y = element_text(colour="black",size=10,face="bold"),

axis.text.x = element_text(colour="black",size=8, face="plain"),

axis.text.y = element_text(colour="black",size=8, face="plain"),

axis.title.x = element_text(colour="black",size=10,face="bold")) +

theme(panel.background = element_rect(fill = "white")) +

theme(plot.title = element_text(lineheight=.8, size=10, face="bold")) +

theme(legend.title=element_blank(), legend.key = element_rect(fill = NA, colour = NA)) +

theme(legend.position="none") +

theme(legend.background = element_rect(fill=NA)) +

theme(plot.margin = unit(c(.25,.25,.0,.0), "cm"))

示例数据MIOT1是一个数字变量(y轴),我正在考虑两个分组因素(开发阶段-x轴)和响应(无响应,沿海,泻湖) .

就像是

stage resp time

pre U 100

pre U 80

pre U 50

pre C 20

flex U 80

flex U 90

flex C 10

flex C 20

post U 40

post U 30

post U 60

post C 80

post C 100

post L 50

post L 40

谢谢!佩德罗

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值