Reputation: 141110
Data
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
Command based on the thread 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;
I get
where the legends of green and blue graphs are wrong (last two graphs); they should be opposite.
Why does the autotitle command give such an output?
Upvotes: 1
Views: 201
Reputation: 2187
You could also (if that's an option for you) change (i.e. correct) the line with the column titles to read
Model Decreasing-err Constant-err Increasing-err
so it matches you data. Gnuplot then indeed gets you the keys as you expected them with your original plot command.
Upvotes: 1
Reputation: 2187
The output you see is more or less want you asked for. The three plots get the titles from column "2" ("decreasing"), "4" ("Increasing"), and "6", only the first line in your data has no column 6. So you get some clobbered remnant from the earlier columns.
You are using data in seven columns, but the line with the titles only has four.
gnuplot has no system of "subcolumns" like your data is organised. Nothing to be done about that, except, like the gnuplot help and the other answer suggest, give an explicit title to each.
Upvotes: 1
Reputation: 48390
Usually, gnuplot automatically counts up the column number used for the autotitle. I'm not sure, why it gets confused here. Maybe gnuplot trys to use the indices from the iteration as column numbers. You can fix this by giving an explicit column number to use for the title
plot for [i=2:6:2] "model1_range.dat" ... title columnheader(i/2+1)
Upvotes: 1