各ボックスプロットの下に観測数を追加したい(図のように、赤い四角形は不要)。 :) しかし、このタイプのボックスプロットに注釈を付ける方法はわかりません(下図参照)。 multiple boxplot annotate number of observationsggplotにグループ化されたboxplotを注釈付ける - boxplot以下の観測数を追加する
どのようにすればいいですか?
これは私がこの図をプロットするために使用したコードです。
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"))<i>
例DATA MIOT1は、数値変数(y軸)であり、Iは、二つのグループ化要素(開発stage- 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
よう
何かがありがとうございます! ペドロ
私たちにいくつかのサンプルデータを入力してください得ることを我々一緒に働くことができます。今、私たちはあなたの問題を再現するのが難しい「MIOT1」が何であるか分かりません。 'dput(MIOT1)'が役に立ちます。詳細については、次の記事を参照してください。http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example –
質問のサンプルデータを追加しました。 ありがとうございました! –