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 Format12 min read
Let’s Code Some Demos Like It’s 1990!
Ferenc Deák never throws anything away, which is why he still has all his demoscene files. Sadly, it also means his fridge is a no-go zone. It all started when this author’s beloved retro PC, used to host nostalgic gaming sessions, I suddenly suffer
Linux Format1 min read
Nvk Is Go!
"NVK, the open source Vulkan driver for Nvidia hardware in Mesa, is ready for prime time. The merge request has landed, getting rid of the nonconformant implementation warnings and signalling to distros that it’s now time to start shipping NVK to use
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

Related