Questions & Answers

Command and Script to re-read a file in gnuplot

I am new to gnuplot and using Ubuntu 12.04. I want to create a graph on the fly when the information is coming in. So i have a data.dat file which looks like:

time server1 server2
0    0       0  
1    2000    3000
2    3000    4000
3    4000    5000

After that i have a script file, loop.plt, that is used to reread the file:

pause 2

And finally, the command I use in in a bash file:

gnuplot -persist -e "plot 'data.dat'" loop.plt

The result comes back as dots - not a line that I expected. But this is only for server1.

How can I change this to create the graph with a line, and also to show the server2 in the same graph? Can someone help me with this?

Answers(1) :

Change your command to the following:

gnuplot -persist -e "plot 'data.dat' using 1:2 with lines ,'' using 1:3 with lines" loop.plt

This plots columns 1 and 2 and columns 1 and 3 using lines

2023-01-19 23:52:20
Thank you for your awnser, when i put this command i take that error, Cannot open load file 'using' line 0: util.c: No such file or directory. and the plot is coming in the front again with dots. Also when i write the (time,server1,server2) i take plot 'data.dat' line 0: Bad data on line 1
2023-01-19 23:52:20
How are you calling the command? It looks like the '' is being removed so gnuplot thinks the file is called using
2023-01-19 23:52:20
i have a bash file. Starting 3 programms in the same time, so i use that command above
2023-01-19 23:52:20
A couple of things you could try. Check the command runs from the command line and replace the '' with 'data.dat'