Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Supposing I have a program that prints lines with data periodically, how can I turn then info them into graphical plot that updates itself each time new line available?

$ ./prog
10 44
20 66
30 55
40 58
50 59
55 58
60 77
^C

$ ./prog | scrollingplot

Window appears and updates on each line printed:

80|                             
  |                        ----   
  |   ----     ______...__/
  |  /    -----
  | -
40|
-------------------------------
    10  20  30   40   50    60

# Note that ASCII art-style plot is just for example, 
# I want simple X window like in mplayer.

There are enough tools for static data, but I haven't seen ones for updating data (except of ksysguard).

share|improve this question
    
Note that I don't want plot in ASCII Art style, it is just to show that there's a plot. I want some GUI window to appear like in mplayer. –  Vi. Jun 4 '10 at 20:01
add comment

2 Answers 2

up vote 2 down vote accepted

If you can run Perl, you could look into this script that seems to do exactly what you want. It is using GnuPlot for displaying the plot.

http://users.softlab.ece.ntua.gr/~ttsiod/gnuplotStreaming.html

GnuPlot is powerful and has many features. If you want to learn more about it, try googling for gnuplot tutorial.

share|improve this answer
    
+1; very cool script (through it takes some time to ^C it ;), and it uses the feature-rich gnuplot. –  whitequark Jun 6 '10 at 1:07
    
Example: for((;;)) { cat /proc/loadavg | grep -o '^[^ ]*' | sed 's/^/0:/' ; sleep 1; } | driveGnuPlotStreams.pl 1 40 0 2 qqq 0 –  Vi. Jun 6 '10 at 19:57
    
Better alternative: git://github.com/dkogan/feedgnuplot.git. After adding option -noraise to gnuplot and making --stream and --lines the default it works well. –  Vi. Jun 6 '10 at 20:38
add comment

Maybe I'm thinking too simple, but: Clear screen with clear and re-execute the plotting program?

share|improve this answer
    
I want GUI tool (same GUI-ness level as display or mplayer) that also can displays coordinate axis, display smooth lines and so on. –  Vi. Jun 4 '10 at 16:17
    
Check "aalib" for this purpose. | aa-project.sourceforge.net/aalib/aalib_16.html#SEC16 –  Shiki Jun 4 '10 at 17:29
    
@Shiki I depicted the plot as AA doesn't means I want the result in AA. It just symbolizes that the plot is drawn. –  Vi. Jun 4 '10 at 19:59
    
Well.. Uhm.. I meant the -vo aa in mplayer for example. ^^" (I'll ask a friend of mine tomorrow, maybe he'll know a good one. As far as I know him, he'll know one. :)) –  Shiki Jun 4 '10 at 20:07
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.