私は2つの観測間の有意性を示すために棒グラフに線を追加しようとしています。私のプロットmy bar plotについては、最初の2つのx軸観測の上に、BDDの怒りとコントロールの怒りの間に大きな違いがあることを示す行を追加したいと思います。例えば:Example bar plotここで行われているものと同様にggplot2を使用して、複数のグループを持つ棒グラフに有意性を示す線をどのように重ねることができますか?
:Indicating the statistically significant difference in bar graph USING R
MY PLOTのCODE:
p <- ggplot(faces_data_accuracy, aes(x=Condition, y=Mean, fill=Group)) +
geom_bar(position=position_dodge(), stat="identity") +
geom_errorbar(aes(ymin=Mean-se, ymax=Mean+se), #ADD ERROR BARS
width=.2, # Width of the error bars
position=position_dodge(.9)) +
ylab("Percentage of Correct Responses")+
xlab("Emotion")+
theme_bw()+
theme(
plot.background = element_blank()
,panel.grid.major = element_blank()
,panel.grid.minor = element_blank()
,panel.border = element_blank()
) +
theme(axis.line = element_line(color = 'grey')) +
scale_fill_brewer(palette="Paired")
は、だから私はp型の座標を持つデータフレームを作成する限り得ています値をプロットし、テキストとしてプロットする:
label.df <- data.frame(Condition = c("Angry", "Angry"), Mean = c(86, 87), Group = c("BDD","Control"))
arc.df <- data.frame(Condition = x, Mean = y)
p+geom_text(data = label.df, label = "p=0.028")+
geom_line(data = arc.df, aes(Condition+1, Mean+10))
私が何をしていても、私は行を追加できないようです。サンプルのプロットのような2つの怒った観測を結ぶy軸の位置80にラインを追加するのを助けてください。