Chapter 5. Practical matters: strings, loops, and history
This chapter covers
- Strings and textual data
- String operations and macros
- Inline loops
- Internal variables and the stats command
- Command history
In the previous chapters, we looked at ways to manipulate and visualize data using gnuplot, which is the core task that gnuplot was designed for. In this chapter, we’ll sidestep the presentation of gnuplot’s graphic capabilities and introduce some foundational features that will be useful later.
First you’ll learn about strings and textual information. Although gnuplot is primarily a tool for creating graphics, textual labels are nevertheless very important: it’s only through information expressed in a human language, which tells the user what is displayed, that a graph receives meaning and semantics. In addition, strings are used in and by gnuplot as a general-purpose data structure—that’s another reason to pay attention to them.
We’ll then introduce some facilities that make it easier to work with gnuplot: internal variables allow you to inspect gnuplot’s internal state and use this information to adjust options accordingly; and inline loops can help significantly reduce the number of keystrokes required when your commands contain repeated operations (for instance, when dealing with a large number of files). As a last topic, we’ll introduce gnuplot’s command history.