2

有两个数据文件,比如data1.txt

31231
32312
32323
32323

数据2.txt

32323
54223
32456
45321

我想在同一张图上绘制这两个图,我该如何gnuplot实现呢?非常感谢你。

4

2 回答 2

6

plot您可以在一个带有两个参数的命令中在同一个图形上获得两个图,datafile用逗号分隔。例如

  plot [-1:5] 'data1.txt' with points, 'data2.txt' with points

会给你这样的东西:

在此处输入图像描述

于 2012-04-26T19:14:19.470 回答
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
于 2015-08-10T03:20:31.490 回答