OESF Portables Forum

Everything Else => General Support and Discussion => Zaurus General Forums => Archived Forums => Software => Topic started by: michael21NEW on January 26, 2006, 11:24:41 am

Title: Gnuplot Question
Post by: michael21NEW on January 26, 2006, 11:24:41 am
Hi,

i am new here, so i really do not know where to post this. Hope i'm right here.

My question is:
Is there any possibility how to plot only the last (let's say 50) values (rows) from an external file using GNUPLOT ?

something like: p [last-50:last] 'data.txt' u 1:2 w l  ??????


I hope someone knows the answer - if there is any.

Thanks in advance for trying to answer.

Best regards
Michael
Title: Gnuplot Question
Post by: jbruno on January 26, 2006, 11:28:58 am
Quote
Hi,

i am new here, so i really do not know where to post this. Hope i'm right here.

My question is:
Is there any possibility how to plot only the last (let's say 50) values (rows) from an external file using GNUPLOT ?

something like: p [last-50:last] 'data.txt' u 1:2 w l  ??????


I hope someone knows the answer - if there is any.

Thanks in advance for trying to answer.

Best regards
Michael
[div align=\"right\"][a href=\"index.php?act=findpost&pid=112508\"][{POST_SNAPBACK}][/a][/div]
Title: Gnuplot Question
Post by: jbruno on January 26, 2006, 11:30:53 am
It looks like the input is a text file, so even if Gnuplot doesn't support what you want, you could run:

Code: [Select]
tail -n 50 data.txt > last50.txt

And then use last50.txt

Quote
Hi,

i am new here, so i really do not know where to post this. Hope i'm right here.

My question is:
Is there any possibility how to plot only the last (let's say 50) values (rows) from an external file using GNUPLOT ?

something like: p [last-50:last] 'data.txt' u 1:2 w l  ??????


I hope someone knows the answer - if there is any.

Thanks in advance for trying to answer.

Best regards
Michael
[div align=\"right\"][a href=\"index.php?act=findpost&pid=112508\"][{POST_SNAPBACK}][/a][/div]
Title: Gnuplot Question
Post by: michael21NEW on January 26, 2006, 11:39:08 am
Thanks for the really fast answers.

I didn't know that one too. But this doesn't solve the whole problem.

The text file is the output of a program, and so there are new entries all the time. I would like to watch them in gnuplot.

Now i am using gnuplot4. Here it is possible to refresh the data with the keys "A" or "E". That ok but it either has a fixed view, or it resizes the whole view to see the whole graph.

I need too see the last entries only. Like "moving" the graph "to the right" without changing the "zoom".

Michael
Title: Gnuplot Question
Post by: lardman on January 26, 2006, 01:10:09 pm
You'd be better looking at specific gnuplot resources, their mailing list/irc channel for example,


Si
Title: Gnuplot Question
Post by: datajerk on January 26, 2006, 07:49:14 pm
Quote
Thanks for the really fast answers.

I didn't know that one too. But this doesn't solve the whole problem.

The text file is the output of a program, and so there are new entries all the time. I would like to watch them in gnuplot.

Now i am using gnuplot4. Here it is possible to refresh the data with the keys "A" or "E". That ok but it either has a fixed view, or it resizes the whole view to see the whole graph.

I need too see the last entries only. Like "moving" the graph "to the right" without changing the "zoom".

Michael
[div align=\"right\"][{POST_SNAPBACK}][/a][/div] (http://index.php?act=findpost&pid=112512\")
I do this with a combination of expect and gnuplot.  You need to write an expect script that will:

1.  Startup gnuplot
2.  tail -50 data >data.50
3.  send gnuplot: plot 'data.50'
4.  tail -50 data >data.50
5.  send gnuplot: replot
6.  sleep
7.  goto 4.

Examples:

data.expect:

#!/usr/bin/expect

system tail -50 data >data.50
spawn gnuplot data.gnuplot -

while {1} {
  sleep 1
  system tail -50 data >data.50
  expect ">"
  send "replot\r" #replot will keep the geometry but adjust the plot axis to match data unless you use set range commands.
}

data.gnuplot:

plot "data.50" with linespoints

For more advanced functions like interaction (A and E keys) use the expect "interact" statements.  Get the book "Exploring Expect".  You can get expect/tcl here (you need tcl for expect):

[a href=\"http://sense.net/zc/files/]http://sense.net/zc/files/[/url]

An an X/QT version of gnuplot 4 I built here:

http://sense.net/zc/gnuplot/ (http://sense.net/zc/gnuplot/)
Title: Gnuplot Question
Post by: michael21NEW on January 27, 2006, 05:45:51 am
thanks very much.
i think this will do it.  

Michael