1
votes

I have one file with two columns containing A/D-samples from two sources. All values are within the range 0-1023 (inclusive) and the sources are not dependant on each other. That is, they are completely different.

Sample excerpt from the datafile:

188   631
196   593
203   594
210   593
218   595
225   593
233   594
240   602
247   593
255   594
262   593
269   594
277   593
284   594

All the values in the first column belongs to A/D-source #1, while all the values in the second column belongs to A/D-source #2.

Now, what I what to do is to get two lines/plots of the respective A/D-source, in the same plot. Since this is my first shot at Gnuplot, I have a hard time to get it right since it seems that no matter what I do Gnuplot interprets the datafile lines as (X, Y) rather than (Y1, Y2) which is what I want. Doing a plain plot 'datafile' will simply bomb all values in a scattered mess.

How do I tell Gnuplot that this particular file contains two datasets, one in each column?

1

1 Answers

2
votes
plot 'datafile' using 0:1, 'datafile' using 0:2

Column 0 is a 'pseudocolumn' that evaluates to the ordinal number of the current data point (usually the line number). If only a single column of data is present the program assumes that x = column(0) and y = column(1). The command given above gives the full specification of what to do with the columns, but a simpler form is also accepted:

plot 'datafile' using 1, '' using 2