gnuplot中的错误栏会更改我的点的位置

时间:2017-12-06 19:37:43

标签: gnuplot errorbar

我的图表最初看起来像这样:

without errorbars

但是如果出现错误,我会得到类似的结果:

with errorbars

这显然不是同一个图,而在我的描述中,我只是简单地添加了“with errorbars”。

我的代码如下:

plot "m20gnu.txt" using 1:2 title"Massa 20 g" pt 1 ps 0.8 lt 9,f(x) title  "Best passende rechte bij massa 20 g"

with errorbars

plot "m20gnu.txt" using 1:2 title"Massa 20 g" with errorbars pt 1 ps 0.8 lt 9,f(x) title  "Best passende rechte bij massa 20 g"

数据文件如下所示:

0.16975     0.058823529     0.005   1

0.165       0.061728395     0.005   1

0.1415      0.047169811     0.005   1

0.13825     0.048543689     0.005   1

0.13975     0.045454545     0.005   1

0.1265      0.054945055     0.005   1

0.146791667 0.052083333     0.005   1

有人知道这里出了什么问题吗? 非常感谢

1 个答案:

答案 0 :(得分:0)

在没有错误栏的情况下进行绘图时,您有using 1:2,这意味着:将第一列用作x,将第二列用作y值。

现在,绘制with errorbars需要三个值。因此,再次使用相同的using语句,您缺少一个值。根据所选的绘图样式,gnuplot会尝试猜测第三个值,如果您没有指定全部。 yerrorbars的文档说:

2 columns: [implicit x] y ydelta
3 columns: x y ydelta
4 columns: x y ylow yhigh

在你的情况下

plot "m20gnu.txt" using 1:2:3 with errorbars

应该有用。