Reputation: 125
There are two data files, say data1.txt:
31231
32312
32323
32323
data2.txt:
32323
54223
32456
45321
I want to draw the two plots on the same graph, how can I use gnuplot
to realize that? Thank yu very much.
Upvotes: 3
Views: 57181
Reputation: 91
This works for me :
reset
set term pngcairo
set output 'wall.png'
set xlabel "Length (meter)"
set ylabel "error (meter)"
set style line 1 lt 1 linecolor rgb "yellow" lw 10 pt 1
set style line 2 lt 1 linecolor rgb "green" lw 10 pt 1
set style line 3 lt 1 linecolor rgb "blue" lw 10 pt 1
set datafile separator ","
set key
set auto x
set xtics 1, 2, 9
set yrange [2:7]
set grid
set label "(Disabled)" at -.8, 1.8
plot "file1.csv" using 1:2 ls 1 title "one" with lines ,\
"file2.csv" using 1:2 ls 2 title "two" with lines ,\
"file3.csv" using 1:2 ls 3 title "three" with lines
set output
Upvotes: 1
Reputation: 17159
You could get two plots on the same graph in one plot
command with two datafile
arguments, separated by a comma. For instance
plot [-1:5] 'data1.txt' with points, 'data2.txt' with points
would get you something like this:
Upvotes: 6