r语言 - 与柱状图相比,错误柱状图太大?



我找不到为什么我的错误栏与我的栏相比如此之大?非常感谢!

df3
Amplitudes   QF Detect_Bin        sd
1          3  0.5  0.2118056 0.2909918
2          3    1  0.2037037 0.3012713
3          3 1.25  0.1701389 0.2931458
4          6  0.5  0.5729167 0.4023829
5          6    1  0.4994213 0.4057509
6          6 1.25  0.4085648 0.4043558
7          9  0.5  0.7384259 0.3479116
8          9    1  0.6574074 0.3831921
9          9 1.25  0.5821759 0.4015536
bar<-ggplot(df3, aes(x= Amplitudes, y= Detect_Bin, fill=Amplitudes))
bar+ 
geom_bar(stat="identity")+
geom_errorbar(aes(ymin=Detect_Bin-sd, ymax=Detect_Bin+sd), width = .2, size=0.5)+
facet_wrap(~QF)+
labs(x="Amplitude du SS", y="Moyenne de détection") 

图情节

我已经复制了你的情节,代码没有任何问题。使用ymin=Detect_Bin-sdymax=Detect_Bin+sd生成错误栏。sd列的值大于或接近Detect_bin中的值。如表中所示,这些值是正确的。

数据
df3 <- data.frame("Amplitudes" = c(3,3,3,6,6,6,9,9,9), "QF" = c(0.5,1,1.25,0.5,1,1.25,0.5,1,1.25), Detect_Bin = c(0.2118056, 0.2037037, 0.1701389, 0.5729167, 0.4994213, 0.4085648, 0.7384259, 0.6574074, 0.5821759), sd = c(0.2909918, 0.3012713, 0.2931458, 0.4023829, 0.4057509, 0.4043558, 0.3479116, 0.3831921, 0.4015536))
df3$Amplitudes <- factor(df3$Amplitudes, levels = c("3","6","9"))

df3 %>% mutate(ymin = Detect_Bin-sd, ymax= Detect_Bin+sd)
<表类>振幅《Detect_Binsdyminymaxtbody><<tr>30.500.21180560.2909918-0.07918620.502797431.000.20370370.3012713-0.09756760.504975031.250.17013890.2931458-0.12300690.463284760.500.57291670.40238290.17053380.975299661.000.49942130.40575090.09367040.905172261.250.40856480.40435580.00420900.812920690.500.73842590.34791160.39051431.086337591.000.65740740.38319210.27421531.040599591.250.58217590.40155360.18062230.9837295

相关内容

  • 没有找到相关文章

最新更新