Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gnuplot plot data from two files: in one x coordinate, in other y

I have two files: one with x coordinates, and other with y.

Is there a way to plot this two files in one graph using gnuplot? Or is there a way to concat row by row this two files?

Thanks

like image 633
sangi Avatar asked Jul 18 '12 19:07

sangi


People also ask

Does gnuplot support multiple Y axes on a single plot?

5.9 Does gnuplot support multiple y-axes on a single plot? Yes.

How use gnuplot to plot data from a file?

To plot functions simply type: plot [function] at the gnuplot> prompt. Discrete data contained in a file can be displayed by specifying the name of the data file (enclosed in quotes) on the plot or splot command line. Data files should have the data arranged in columns of numbers.

What are possible output formats of gnuplot?

png, and svg terminal It exists also a png terminal, but it produces uglier output and doesn't use the UTF-8 encoding the cairo library does. You may also have noticed that we set the size to a given x,y value. If we don't do this, the default value of 640,480 is used.

What is gnuplot C?

Gnuplot is a portable command-line driven graphing utility for Linux and other OS. C and Gnuplot can be used to plot complex functions. One can write the function in C and then write the values of the function at various values in a txt file, which can then be plotted using Gnuplot.


1 Answers

There is not a way to plot the x coordinate from one file and the y coordinate from another natively in gnuplot.

If you use a bash-like shell, you can use the command

paste x_data.dat y_data.dat > xy_data.dat

to combine files row-by row. If you want to put this command into a gnuplot script, you can do so like this:

plot "<paste x_data.dat y_data.dat"
like image 119
andyras Avatar answered Sep 29 '22 18:09

andyras