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?
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
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).
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
© 2022 - 2024 — McMap. All rights reserved.
matplotlib
. – Kislev