Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Live plot from stdin

Tags:

plot

live

I have an application which prints numbers to stdout. Is there an easy way of using any commandline plot tool (gnuplot) for a live plot of the image?

like image 463
Johan Avatar asked Nov 09 '10 13:11

Johan


3 Answers

I would highly recommend ttyplot, you can build live graphs directly in the terminal, reading data from STDIN

enter image description here

Another option is to use sampler: Tool for shell commands execution, visualization and alerting. Configured with a simple YAML file.

enter image description here

like image 168
grundic Avatar answered Nov 08 '22 05:11

grundic


You can redirect the numbers to a file and read the file periodically either using gnuplot's reread command or manually pressing e on the plot window.

shell$ command > points.dat

In gnuplot

gnuplot> plot "points.dat" using 1:2

and press e on the window to update it, or see the example from

gnuplot> help reread
like image 38
Jari Laamanen Avatar answered Nov 08 '22 05:11

Jari Laamanen


I wrote livechart for exactly this purpose. It's based on matplotlib and accepts either numbers or JSON objects with numeric data via stdin.

sudo pip install livechart

Note that Python2.7 is recommended because matplotlib wouldn't quite work for me under 3.x. Also, you might need to install a C++ compiler to build matplotlib (sudo apt-get install g++ on Debian).

like image 1
sevko Avatar answered Nov 08 '22 04:11

sevko