The simplest way to start PyXPlot is to type pyxplot at a shell prompt. This starts an interactive session, and a PyXPlot command-line prompt into which commands can be typed will appear. PyXPlot can be exited either by typing exit or quit, or by pressing CTRL-D. Various switches can be specified on the shell command line to modify PyXPlot’s behaviour; these are listed in Box 3.1. Of especial interest may be the switches -c and -m, which change between the use of colour-highlighted (default) and non-coloured text.
Typing commands into interactive terminals will probably be a sufficient way to drive PyXPlot to begin with, but as the number of commands required to set up plots grows with the complexity of the task, it is likely to become rapidly more preferable to store these commands in text files called scripts. Once such a script has been written, it can be executed automatically by passing the filename of the command script to PyXPlot on the shell command line, for example:
pyxplot foo.ppl
From the shell command line, PyXPlot accepts the following switches which modify its behaviour:
|
In this case, PyXPlot would execute the commands in the file foo.ppl and then exit. By convention, we choose to affix the suffix .ppl to the filenames of all PyXPlot command scripts. This is not strictly necessary, but allows PyXPlot scripts to be easily distinguished from other text files in a filing system. The filenames of several command scripts may be passed to PyXPlot on a single command line, indicating that they should be executed in sequence, as in the example:
pyxplot foo1.ppl foo2.ppl foo3.ppl
It is also possible to have a single PyXPlot session alternate between running command scripts autonomously and allowing the user to enter commands interactively between the running of the scripts. There are two ways of doing this. PyXPlot can be passed the magic filename – on the command line, as in the example
pyxplot foo1.ppl -- foo2.ppl
where the – represents an interactive session which commences after the execution of foo1.ppl and should be terminated by the user in the usual way, using either the exit or quit commands. After the interactive session is finished, PyXPlot will automatically execute the command script foo2.ppl.
From within an interactive session, it is possible to run a command script using the load command, as in the example:
pyxplot> load ’foo.ppl’
This example would have the same effect as typing the contents of the file foo.ppl into the present interactive terminal.
The save command may assist in producing PyXPlot command scripts: it stores a history of the commands which have been typed into the present interactive session to file.
Footnotes