Live plot from stdin
Asked Answered
R

4

8

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?

Relation answered 9/11, 2010 at 13:46 Comment(1)
It would be easy to write such a tool in Python, using matplotlib.Kislev
B
6

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

Ballottement answered 17/4, 2019 at 20:24 Comment(0)
M
3

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
Malamute answered 28/11, 2011 at 17:6 Comment(0)
I
1

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).

Ia answered 12/6, 2015 at 18:51 Comment(0)
I
-1

You can use plotti.co to export your plot to the web in a one-liner like this:

<program> | xargs -L1 sh -c 'wget -q -O /dev/null http://plotti.co/4134314?d=$0'

And you will view it live at address http://plotti.co/4134314/plot.svg

Disclaimer: I am the creator of plotti.co

Isotherm answered 16/3, 2016 at 14:57 Comment(1)
Seems to be a dead link. It would be nice if you posted an example here.Wrasse

© 2022 - 2024 — McMap. All rights reserved.