为什么这个 Gnuplot 中的自动标题错误?
Why autotitle wrong in this Gnuplot?
数据
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
基于线程的命令
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命令会给出这样的输出?
通常,gnuplot 会自动计算用于自动标题的列号。我不确定,为什么它会在这里混淆。也许 gnuplot 尝试使用迭代中的索引作为列号。您可以通过为标题提供明确的列号来解决此问题
plot for [i=2:6:2] "model1_range.dat" ... title columnheader(i/2+1)
您看到的输出或多或少是您想要的。这三个图的标题来自列“2”("decreasing")、“4”("Increasing")和“6”,只有数据中的第一行没有第 6 列。所以你得到早期专栏中的一些破坏性残余。
您正在使用七列数据,但标题行只有四列。
gnuplot 没有 "subcolumns" 像您的数据组织系统。对此无能为力,除了像 gnuplot 帮助和其他答案建议的那样,给每个人一个明确的标题。
您也可以(如果这是您的选择)更改(即更正)包含列标题的行以阅读
Model Decreasing-err Constant-err Increasing-err
所以它匹配你的数据。然后 Gnuplot 确实为您提供了您使用原始 plot 命令所期望的密钥。
数据
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
基于线程的命令
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命令会给出这样的输出?
通常,gnuplot 会自动计算用于自动标题的列号。我不确定,为什么它会在这里混淆。也许 gnuplot 尝试使用迭代中的索引作为列号。您可以通过为标题提供明确的列号来解决此问题
plot for [i=2:6:2] "model1_range.dat" ... title columnheader(i/2+1)
您看到的输出或多或少是您想要的。这三个图的标题来自列“2”("decreasing")、“4”("Increasing")和“6”,只有数据中的第一行没有第 6 列。所以你得到早期专栏中的一些破坏性残余。
您正在使用七列数据,但标题行只有四列。
gnuplot 没有 "subcolumns" 像您的数据组织系统。对此无能为力,除了像 gnuplot 帮助和其他答案建议的那样,给每个人一个明确的标题。
您也可以(如果这是您的选择)更改(即更正)包含列标题的行以阅读
Model Decreasing-err Constant-err Increasing-err
所以它匹配你的数据。然后 Gnuplot 确实为您提供了您使用原始 plot 命令所期望的密钥。