Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Gnuplot 多点打印中的错误条偏移_Gnuplot_Errorbar - Fatal编程技术网

Gnuplot 多点打印中的错误条偏移

Gnuplot 多点打印中的错误条偏移,gnuplot,errorbar,Gnuplot,Errorbar,data.txt test1 10 1 test2 10 2 test3 12 3 .plt文件 set terminal postscript eps solid color enhanced "Helvetica" 20 set output "io1.eps" set size 1,1 set multiplot layout 1,2 set style histogram errorbars gap 1 lw 1 title textcolor lt -1 set

data.txt

test1   10  1

test2   10  2

test3   12  3
.plt文件

set terminal postscript eps solid color enhanced "Helvetica" 20
set output "io1.eps"
set size 1,1
set multiplot layout 1,2
set style histogram errorbars gap 1 lw 1 title textcolor lt -1
set style data histograms

set lmargin at screen 0.1; set rmargin at screen 0.45
set xrange [-0.5:1.5]
set yrange [0:15]
plot './data.txt' every :::0::0 using 2:3 title "aaa" fc rgb "#00ff00" fs pattern 9

set lmargin at screen 0.55; set rmargin at screen 0.9
set xrange [-0.5:1.5]
set yrange [0:15]
plot './data.txt' every :::1::1 using 2:3 title "bbb" fc rgb "#f0f000" fs pattern 3 

unset multiplot
结果

问题


第二个子图中的“平均值”列和错误栏之间存在间隙,如何修复?

我没有完全解释为什么会发生这种情况。gnuplot似乎隐式地使用了当前数据集中的记录索引。当两个空行开始一个新的数据集时,该索引被重置

也许您可以通过在数据行之间使用两个空行来更改数据文件,而不是仅使用一个空行。然后您可以使用
索引
访问数据,而不是像这样使用
每个

替换两个plot命令

plot './data.txt' every :::0::0 using 2:3 title "aaa" fc rgb "#00ff00" fs pattern 9
plot './data.txt' every :::1::1 using 2:3 title "bbb" fc rgb "#f0f000" fs pattern 3

现在它可以工作了:

plot './data.txt' index 0 using 2:3 title "aaa" fc rgb "#00ff00" fs pattern 9
plot './data.txt' index 1 using 2:3 title "bbb" fc rgb "#f0f000" fs pattern 3