Search code examples
gnuplot

gnuplot draw two plots on the same graph with single column data


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.


Solution

  • 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:

    enter image description here