带有错误栏绘图的gnuplot

use*_*901 15 plot gnuplot

我的"file.txt"文件中的数据如下所示(显示的示例行)

31 1772911000 6789494.2537881
Run Code Online (Sandbox Code Playgroud)

请注意,第二列是平均值,第三列是我输入样本的标准偏差.因此,对于误差条,我需要x轴值为31的条形,误差条从(第二列值)开始 - (第三列值),并以(第二列值)+(第三列值)结束).我尝试了以下方法:

plot "file.txt" using ($1-$2):1:($2+$1) with errorbars
Run Code Online (Sandbox Code Playgroud)

但结果不合适.有帮助吗?

Phi*_*l H 25

你需要x:y:错误,所以试试吧

plot "file.txt" using 1:2:3 with yerrorbars
Run Code Online (Sandbox Code Playgroud)

yerrorbars

你可能想要烛台.这些通常是一个带有从顶部和底部伸出的误差条的盒子,但是设置分钟和最大值应该给你所需尺寸的盒子:

plot "file.txt" using 1:($2-$3):($2-$3):($2+$3):($2+$3) with candlesticks
Run Code Online (Sandbox Code Playgroud)

烛台

  • @ user506901 - 看起来(对我来说是gnuplot文档)你只需要`plot"file.txt"使用...用烛台" - 我不确定Phil H用`set style boxplot做什么烛台`...(我正在使用gnuplot 4.4.2),也许这种行为在4.6中有所改变? (2认同)

hmi*_*tcs 5

你也可以尝试:

plot "file.txt" using 1:2:($2-$3):($2+$3) with errorbars
Run Code Online (Sandbox Code Playgroud)

($ 2- $ 3)是y误差条低值,($ 2 + $ 3)是y误差条高值

但是,我认为您应该使用标准误差=标准偏差/平方根(样本大小)而不是标准偏差来计算误差线.