Linux Format

Live-plotting data

One popular choice for logging into Linux machines on Windows is puTTY. Admittedly, it only acts as a dumb terminal, but a command line interface is perfectly good for coding, especially when a fancy GUI would slow down the network connection. One possible drawback would seem to be the inability to generate live plots of machine activity using the beautiful graphics in Gnuplot (see John Lane’s article in LXF244 for an introduction),

A live plot is a graph that’s periodically updated to reflect changes to its input data. That’s well within Gnuplot’s skillset, and can be coded using a while loop and calls to replot and pause . However, this tutorial describes a variation of that approach, where a shell script wakes up Gnuplot accordingly when it’s time to update the plot.

The restriction to a dumb terminal turns out to be no problem for Gnuplot either – it can generate graphs for a wide range of devices, including dumb ones. The resulting graphics are a little primitive, so the script described here also produces PNG files, and an animated GIF. The GIF acts as a simple record of all the changes to the plot during the script’s execution.

See Figure 1 for a summary of the. When it’s time for plotting, the script sends an integer to the script via a pipe. The script is waiting for integer input, then reads in the data file, and generates new text-based and PNG graphs. Then it suspends again, waiting for another integer.

You’re reading a preview, subscribe to read more.

More from Linux Format

Linux Format3 min read
Kernel Watch
Linus Torvalds announced the fourth RC (Release Candidate) for what will become Linux 6.9 in another few weeks. In his announcement, he noted that there was “Nothing particularly unusual going on this week – some new hardware mitigations may stand o
Linux Format2 min read
Specialist Tool Organisation
K ali works differently from the others as it has the security tools in the root of the app launcher. If you know what you’re looking for, the whole thing is searchable from the launcher. The ‘normal’ apps are located in the Usual Applications folder
Linux Format14 min read
Ubuntu at 20
Without Ubuntu, the current Linux landscape would be unrecognisable. Back in October 2004, the first 4.10 (2004.10) release of Ubuntu, with its intriguing Warty Warthog code name, leapt from obscurity to being one of the most downloaded Linux distrib

Related