2.1 Getting Started

The simplest way to start PyXPlot is to type ‘pyxplot’ at a shell prompt to start an interactive session. A PyXPlot command-line prompt will appear, into which commands can be typed. PyXPlot can be exited either by typing exit, quit, or by pressing CTRL-D.

As you begin to plot increasingly complicated graphs, the number of commands required to set them up and plot them will grow. It will soon become preferable, instead of typing these commands into an interactive session, to store lists of commands as scripts, which are simply text files containing PyXPlot commands. These may be executed by passing the filename of the command script to PyXPlot on the shell command line, for example:

pyxplot foo.ppl

In this case, PyXPlot would execute all of the commands in the file foo.ppl and then exit immediately afterwards. By convention, we suffix the filenames of PyXPlot command scripts with ‘.ppl’, though this is not strictly necessary. Several filenames may be passed on a single command line, indicating a series of scripts to be executed in sequence:

pyxplot foo1.ppl foo2.ppl foo3.ppl

It is possible to use a single PyXPlot session both interactively and from command scripts. One way to do this is to pass the magic filename ‘–’ on the command line:

pyxplot foo1.ppl - foo2.ppl

This magic filename represents an interactive session, which commences after the execution of foo1.ppl, and should be terminated in the usual way after use, with the exit or quit commands. Afterwards, the command script foo2.ppl would execute.

From within an interactive session, it is possible to run a command script using the load command:

pyxplot> load 'foo.ppl'

This example would have the same effect as typing the contents of the file foo.ppl into the present session.

Usually a text editor is used to produce PyXPlot command scripts, but the save command may also assist. This stores a history of the commands executed in the present interactive session to file.

Command files can include comment lines, which should begin with a hash character, for example:

# This is a comment

Comments may also be placed on the same line as commands, for example:

set nokey # I'll have no key on _my_ plot

Long commands may be split over multiple lines in the script by terminating each line of it with a backslash character, whereupon the following line will be appended to it.