有两个数据文件,例如 data1.txt :
31231
32312
32323
32323
data2.txt :
32323
54223
32456
45321
我想在同一个图表上绘制两个图,我如何使用gnuplot
来实现这一点?非常感谢yu。
答案 0 :(得分:5)
您可以在一个plot
命令中使用两个datafile
参数在同一个图上获得两个图,用逗号分隔。例如
plot [-1:5] 'data1.txt' with points, 'data2.txt' with points
会得到这样的东西:
答案 1 :(得分:1)
这对我有用:
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