Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Plot two lines in gnuplot

Tags:

gnuplot

I have file with two columns like:

1.2, 3.4
5.6, 7.8
...

I want gnuplot to plot both columns in one coordinate system like it would, if there was only one column. Meaning: X-axis shows the line numbers, y-axis the values.

Example: The first two points of the two lines are (0, 1.2)and (0, 3.4); the second points (1, 5.6) and (1, 7.8).

I do not want the two columns being treated as x and y values, like it would if just go for plot "data.txt".

like image 471
albifant Avatar asked Jan 02 '13 10:01

albifant


1 Answers

You can use the zero pseudo column which holds the current sample number. From help pseudocolumns:

column(0)
    The sequential order of each point within a data set.
    The counter starts at 0 and is reset by two sequential blank

For example:

plot 'data.txt' using 0:1, '' using 0:2

The empty '' uses the same data-source as the previous plot.

like image 64
Thor Avatar answered Nov 03 '22 04:11

Thor