2
votes

I have two data files

# a.txt
1,    1,   1
2,    4,   1
3,    9,   5
4,   16,   1
5,   25,  1
6,   36,  1
7,   49,  1
8,   64,  1
9,   81,  1
10, 100,  1

and

# b.txt
1,    1,   1
2,    3,   1
3,   10,   1
4,   17,   1
5,   24,  1
6,   34,  1
7,   48,  1
8,   62,  1
9,   85,  3
10, 98,  1

I want to plot these two data in a single image with its error bars and top right label as "a" and "b", Initially I tried to plot the files using

plot 'a.txt' u 1:2:3 w yerrorbars l, 'b.txt' u 1:2:3 w yerrorbars l

which plotted the error graph but not the lines, then I tried this method

plot 'a.txt' u 1:2 with lines,'a.txt' u 1:2:3 w yerrorbars,'b.txt' u 1:2 with lines,'b.txt' u 1:2:3 w yerrorbars

Now it plots the error bars and the lines but now I have four labels instead of two.

How can I plot error bars with lines in gnuplot?

1

1 Answers

3
votes

The argument is named errorlines

$a <<EOD
1,    1,   1
2,    4,   1
3,    9,   5
4,   16,   1
5,   25,  1
6,   36,  1
7,   49,  1
8,   64,  1
9,   81,  1
10, 100,  1
EOD
$b <<EOD
1,    1,   1
2,    3,   1
3,   10,   1
4,   17,   1
5,   24,  1
6,   34,  1
7,   48,  1
8,   62,  1
9,   85,  3
10, 98,  1
EOD

plot $a u 1:2:3 w errorlines, $b u 1:2:3 w errorlines l