Gnuplot: displaying data from multiple input files in one chart

I am trying to plot using gnuplot.I has 6 text files. Each text file contains two columns. The first column represents the time in seconds (this is a floating point number). The second is the serial number. I want to build a timeline by the serial number in one schedule for all six files. I use this file for this.

set terminal png set output 'akamai.png' set xdata time set timefmt "%S" set xlabel "time" set autoscale set ylabel "highest seq number" set format y "%s" set title "seq number over time" set key reverse Left outside set grid set style data linespoints plot "print_1012720" using 1:2 title "Flow 1", \ plot "print_1058167" using 1:2 title "Flow 2", \ plot "print_193548" using 1:2 title "Flow 3", \ plot "print_401125" using 1:2 title "Flow 4", \ plot "print_401275" using 1:2 title "Flow 5", \ plot "print_401276" using 1:2 title "Flow 6" 

Where are my files

print_1012720
print_1058167
print_193548
print_401125
print_401275
print_401276

This gives a strange error, as shown below. "plot.plt", line 24: undefined variable: plot

I am doing something wrong. Is it possible to build data from different files on the same chart. I am new to gnuplot, any help is appreciated.

~

+61
gnuplot
Jun 18 2018-12-18T00:
source share
3 answers

You are so close!

Edit:

 plot "print_1012720" using 1:2 title "Flow 1", \ plot "print_1058167" using 1:2 title "Flow 2", \ plot "print_193548" using 1:2 title "Flow 3", \ plot "print_401125" using 1:2 title "Flow 4", \ plot "print_401275" using 1:2 title "Flow 5", \ plot "print_401276" using 1:2 title "Flow 6" 

at

 plot "print_1012720" using 1:2 title "Flow 1", \ "print_1058167" using 1:2 title "Flow 2", \ "print_193548" using 1:2 title "Flow 3", \ "print_401125" using 1:2 title "Flow 4", \ "print_401275" using 1:2 title "Flow 5", \ "print_401276" using 1:2 title "Flow 6" 

The error is that gnuplot is trying to interpret the word "plot" as the name of the file to build, but you have not assigned any lines to a variable named "plot" (which is good - it would be very confusing).

+103
Jun 18 2018-12-18T00:
source share

You may find that gnuplot for loops is useful in this case if you adjust your file names or graphics accordingly.

eg.

 filenames = "first second third fourth fifth" plot for [file in filenames] file."dat" using 1:2 with lines 

and

 filename(n) = sprintf("file_%d", n) plot for [i=1:10] filename(i) using 1:2 with lines 
+54
Jan 27 '14 at 23:06
source share

replot is another way to get multiple charts at once:

 plot file1.data replot file2.data 
+13
Oct 08 '15 at 17:21
source share



All Articles