I have two files A and B. Both files contain 2 columns, x and y.
Now, I want to plot a graph for x vs (yA – yB). Does gnuplot provide a command for the same ?
One more thing, lets say xA and xB are not same. How should I plot a graph where x-axis contains all elements which are in both, xA and xB and y-axis is the difference is the corresponding y-components ?
Best Answer
First, preprocess the files with
join
in bash:Sorting the files is essential, otherwise
join
would not work.Then you can use the result to draw the graph:
Again, numeric sorting is needed here, because
join
uses alphanumeric sorting which makes the lines cross each other.