使用Gnuplot的错误栏从两个文件进行绘图 [英] Plot from two files with errorbars for Gnuplot

查看:125
本文介绍了使用Gnuplot的错误栏从两个文件进行绘图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在考虑通过考虑数据格式来更好地添加错误栏的方法. 例如,在此处中讨论了添加误差线的标准方法.

I am thinking which way to do the addition of errorbars better by thinking the format of data. The standard way of adding errors bars is discussed here, for instance.

我的原始数据在范围内

Model Decreasing Constant Increasing 
2025 73-78 80-85 87-92 
2035 63-68 80-85 97-107 
2050 42-57 75-90 104.5-119.5 

其中的值是范围. 我无法直接在Gnuplot中进行绘图,因此我必须将其拆分为平均值和两个文件中的误差值:

where the values are ranges. I cannot plot directly in Gnuplot so I have to split it to averages and to error values in two files:

平均值:

Model Decreasing Constant Increasing
2025 75.5 82.5 89.5
2035 65.5 82.5 102
2050 49.5 82.5 112

和ybar中的错误配置

and error configuration in ybar

Model Decreasing Constant Increasing
2025 2.5 2.5 2.5
2035 2.5 2.5 5
2050 7.5 7.5 7.5

我通常将这样的数据绘制为一个文件

I normally plot data like this as a one file

plot for [i=2:4] 'data.dat' using 1:i w linespoints

但是现在我在做图时应该同时浏览两个文件. 绘制误差线的常规语法是

but now I should go through two files at the same time while doing the plot. The normal syntax of plotting errorbars is

plot 'data' using 1:2:0:($1+$3):4:5 with yerrorlines

和手册此处.

如何在Gnuplot中从两个带有错误栏的文件中绘图? 如果您知道在gnuplot中添加这些错误栏的更好方法,请随时提出.

How can you plot from two files with errorbars in Gnuplot? Feel free to propose if you know better way to do the addition of these errorbars in gnuplot.

其中错误点在第一点和第三点缺失.

where error bars missing in the first and third points.

推荐答案

Gnuplot 5支持您指定几个字符作为数据文件分隔符.

Gnuplot 5 supports that you specify several characters as data file separators.

因此,如果您确定永远不会得到负值(我希望给定数据格式),则可以使用原始数据文件并将空白和连字符设置为数据文件分隔符:

So, if you are sure you'll never get negative values (which I hopen given the format of your data), then you can use your original data file and set both white space and hyphen as datafile separator:

set datafile separator " -"
plot for [i=2:6:2] "data" using 1:(0.5*(column(i)+column(i+1))):(0.5*(column(i+1)-column(i))) with yerrorlines

这篇关于使用Gnuplot的错误栏从两个文件进行绘图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆