数据
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
基于线程here
的命令set terminal qt size 560,270;
set grid; set offset 1,1,0,0;
set datafile separator " -";
set key autotitle columnhead
plot for [i=2:6:2] "model1_range.dat" using 1:(0.5*(column(i)+column(i+1))):(0.5*(column(i+1)-column(i))) with yerrorlines;
我得到了
绿色和蓝色图形的图例是错误的(最后两张图);他们应该相反。
为什么autotitle命令会提供这样的输出?
答案 0 :(得分:1)
通常,gnuplot会自动计算用于自动标题的列号。我不确定,为什么在这里感到困惑。也许gnuplot尝试使用迭代中的索引作为列号。您可以通过提供用于标题
的显式列号来解决此问题plot for [i=2:6:2] "model1_range.dat" ... title columnheader(i/2+1)
答案 1 :(得分:1)
您看到的输出或多或少是您想要的。这三个图得到了列“2”(“递减”),“4”(“增加”)和“6”的标题,只有数据中的第一行没有第6列。所以你得到一些破坏的残余来自早期的专栏。
您正在使用七列中的数据,但带有标题的行只有四列。
gnuplot没有像您的数据组织的“子列”系统。没有什么可以做的,除了像gnuplot帮助和其他答案建议,给每个人一个明确的标题。
答案 2 :(得分:1)
您也可以(如果这是您的选项)更改(即更正)具有要读取的列标题的行
Model Decreasing-err Constant-err Increasing-err
所以它匹配你的数据。然后,Gnuplot确实会按照您对原始绘图命令的预期来获取密钥。