gnuplot直方图错误栏问题 [英] gnuplot histogram errorbar problems
问题描述
我正在尝试在gnuplot中使用错误栏,但遇到了两个问题.第一个问题是误差线未正确对齐.第二个问题是使用误差线时无法指定多个数据集.
I'm trying to use error bars with gnuplot but am running into two problems. The first problem is that the error bars are not correctly aligned. The second problem is that I can't specify multiple data sets when using error bars.
第一个问题是误差线未正确对齐,如下图所示:
The first problem is that the error bars are not correctly aligned as can be seen in the following image:
此图像是通过以下脚本生成的:
This image was generated from the following script:
set terminal postscript eps enhanced
set yrange [0:20]
set style data histogram
set style histogram errorbars gap 1
set output 'out.eps'
plot "test.dat" using 2:3
以及以下测试输入数据
header colA errA colB errB
typeX 10.0 1.0 15.1 1.5
typeY 5.0 0.5 12.1 0.8
x轴上点0.5处的条误差线应与第一个直方图输入相关联,而不是偏移.我已经尝试了一些不同的方法,这个简单的示例与
The bar error bar at point 0.5 on the x-axis should be associated with first histogram entry rather than being offset. I've tried a few different things, and this simple example is very close to what is shown in the gnuplot 5.0 user manual on page 55 (screenshot below since there isn't an HTML version.
使用与之前相同的测试输入数据,以下代码将生成带有两个数据集的直方图,这些数据集不使用误差线 :
Using the same test input data from before, the following code will generate a histogram plot with two data sets without using error bars:
set terminal postscript eps enhanced
set yrange [0:20]
set style data histogram
set style histogram
set output 'out.eps'
plot 'test.dat' using 2, '' using 4
但是,如果我尝试修改它(如下所示)以生成错误栏,则会得到一个无效的eps文件,该文件无法显示.
But if I try to modify this, as shown below, to generate error bars I get an invalid eps file that can't be displayed.
set terminal postscript eps enhanced
set yrange [0:20]
set style data histogram
set style histogram errorbars
set output 'out2.eps'
plot 'test.dat' using 2:3, '' using 4:5
我已经在使用gnuplot 5.0 patchlevel 2
的OS X和使用gnuplot相同版本以及gnuplot 5.0 patchlevel 3
I have tested this on both OS X with gnuplot 5.0 patchlevel 2
and on Arch Linux with the same version of gnuplot and also with gnuplot 5.0 patchlevel 3
推荐答案
注释掉第一行(标题),这解决了两个问题:
Comment out the first line (header), this solved both problems:
#header colA errA colB errB
typeX 10.0 1.0 15.1 1.5
typeY 5.0 0.5 12.1 0.8
这篇关于gnuplot直方图错误栏问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!