Chapter 11. Automation, scripting, and animation

 

This chapter covers

  • Loops and conditionals
  • Command files and batch processing
  • Calling gnuplot from other programs
  • Animations

In the preceding chapters, we’ve studied most commands and options that can be used from within gnuplot. But up to this point, our discussions assumed that you’d be running gnuplot interactively: entering commands, viewing plots, and then entering more commands.

But sometimes that’s not what you want. For instance, you may have a large number of data sets and just want to convert all of them to plots: it would be great to automate this task through scripting. Or you may have a cron job running nightly to scan web server logs and want it to also generate some plots showing the number of hits per hour, without requiring human intervention: that’s batch processing. Or you might want to use gnuplot as a graphing back end, while tendering control to some other program.

All these situations involve tasks that have been automated to some degree. In this chapter, we’ll study ways to do this, either using gnuplot’s own facilities or using gnuplot in conjunction with an external programming language.

11.1. Loops and conditionals

11.2. Command files

11.3. Batch processing

11.4. Calling gnuplot from other programs

11.5. Animations

11.6. Case study: continuously monitoring a live data stream

11.7. Summary