Fitting data in gnuplot with xyerrorbars

I was looking at the examples that show how to fit data using gnuplot (ex: gnuplot / misc (2E)) but I can't find a place that shows what to do if I have ranges for the x and y error bars. I tried the common sense:

gnuplot> fit f(x) "data.txt" using 3:6:4:5:7:8 via a,b
                                                          ^
                            Too many columns in using specification

But I get the error shown above. Any idea why this doesn't work? Because when I plot my data I use:

plot "data.txt" using 3:6:4:5:7:8 with xyerrorbars 

and it works.

Does my question make sense? I am just wondering if the fit function can take the errors in consideration....

Sounds to me like you have "too many columns in using specification" :smiley:

One obviously path to solving this could be to look closely at the number of columns in your data and the number of columns in your gnuplot command (specification).

I am using 6 columns:
x : y : min x : max x : min y: max y

where min and max are the range of the errors for x and y... when I plot a file withe these columns I get a correct plot, but I can't use the same thing to fit the data... do you know what I mean?

Maybe the utility does not like the spaces between the column names, for example "min x"...

Did you look at some examples?

Can you post some sample data?

f(x)= (a*x)+b

fit f(x) "data.txt" using 3:6:4:5:7:8 via a,b

plot "data.txt" using 3:6:4:5:7:8 with xyerrorbars "data", f(x) title "fit line"

Where this is the data file:

1   NGC1651   9.30096   9.07913   9.4471   9.06064   7.74814   9.60308
2   NGC1711   7.4   7.2   7.6   7.72423   6.78529   8.2304
3   NGC1718   9.3979   9.30096   9.47707   8.32217   7.61273   9.60308
4   NGC1755   7.5   7.3   7.7   8.25522   7.61273   8.51846
5   NGC1777   8.95418   8.84504   9.04134   8.41492   7.69892   9.30529
6   NGC1783   8.95418   8.69891   9.11387   9.03337   7.81286   9.35212
7   NGC1810   7.69891   6.99996   7.95418   6.77811   6.6812   7.68119
8   NGC1818   7.23039   7.20407   7.25523   7.38016   6.70753   7.84505
9   NGC1831   8.60202   8.46235   8.7075   8.74031   8.32217   8.85728
10   NGC1834   7.68119   7.51846   7.79927   7.46235   6.71596   7.91376
11   NGC1836   7.57974   7.4471   7.68119   8.17604   7.53143   8.63341
12   NGC1838   8.09685   7.99996   8.17602   7.79234   6.79235   8.47707
13   NGC1839   7.51846   7.3979   7.61274   7.96843   7.51847   8.43131
14   NGC1844   7.7075   7.67207   7.74029   8.36167   7.67205   8.602
15   NGC1846   9.27868   9.25523   9.30096   9.08273   7.70752   9.60308
16   NGC1847   7.20407   7.07913   7.30096   7.67205   6.75583   8.32217
17   NGC1850   7.60202   7.47707   7.69891   7.91903   7.44711   8.43131
18   NGC1854   7.47707   7.30096   7.60202   7.74814   6.78529   8.36167
19   NGC1856   7.90302   7.69891   8.04134   7.88076   6.79235   8.53142
20   NGC1858   7.23039   7.04134   7.36168   6.70753   6.54403   6.75583

There is 8 columns in the data.

Posted from my Samsung Galaxy S mobile.

But I am specifying which columns to use:

f(x)= (a*x)+b

fit f(x) "data.txt" using 3:6:4:5:7:8 via a,b

plot "data.txt" using 3:6:4:5:7:8 with xyerrorbars "data", f(x) title "fit line"