gnuplot使用单列数据在同一图形上绘制两个图

gnuplot使用单列数据在同一图形上绘制两个图,gnuplot,Gnuplot,有两个数据文件,例如data1.txt: 31231 32312 32323 32323 32323 54223 32456 45321 data2.txt: 31231 32312 32323 32323 32323 54223 32456 45321 我想在同一个图形上绘制两个图,我如何使用gnuplot来实现这一点?非常感谢您。您可以在一个plot命令中获得同一图形上的两个绘图,其中包含两个datafile参数,用逗号分隔。比如说 plot [-1:5] 'data1.txt'

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

31231
32312
32323
32323
32323
54223
32456
45321
data2.txt

31231
32312
32323
32323
32323
54223
32456
45321

我想在同一个图形上绘制两个图,我如何使用
gnuplot
来实现这一点?非常感谢您。

您可以在一个
plot
命令中获得同一图形上的两个绘图,其中包含两个
datafile
参数,用逗号分隔。比如说

  plot [-1:5] 'data1.txt' with points, 'data2.txt' with points
你会得到这样的东西:

这对我来说很有用:

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

我怎么画线?我尝试用线条绘制“data1”、“data2”,但我得到了所有点,并且这些点都位于0 x轴上。线条仅适用于第二个数据文件。尝试用线条绘制“数据1”,用线条绘制“数据2”。看起来
gnuplot
无法在同一目录中找到文件
data2
。我也尝试了
plot'data1',data2'和点
,但无法得到你得到的。所有的点都在0 x轴上,这是为什么?可能是y轴上的刻度错误,或者gnuplot无法读取正确的“data1”文件。如果您在linux上,可以键入gnuplot命令
!cat data1
以查看文件的内容。