Labels can be added to the two axes of a plot, and a title put at the top. Labels should be placed between either single (’) or double (") quotes. For example:
set xlabel "$x/{\rm m}$" set ylabel "$h/{\rm m}$" set title 'Trajectories of rockets fired with speed $v$ and \ angle $\theta$'
The output produced by these commands is shown in Figure 2.1. Note that the labels and title, and indeed all text labels in PyXPlot, are rendered using LaTeX, and so any LaTeX commands can be used. As a caveat, however, this does mean that care needs to be taken to escape any of LaTeX’s reserved characters – i.e.: & % # { } $ _
or
.
Because of the use of quotes to delimit text labels, special care needs to be taken when apostrophe and quote characters are used. The following command would raise an error, because the apostrophe would be interpreted as marking the end of the text label:
|
set xlabel ’My plot’s X axis’ |
The following would achieve the desired effect:
|
set xlabel "My plot’s X axis" |
To make it possible to render LaTeX strings containing both single and double quote characters – for example, to put a German umlaut on the name ‘Jörg’ in the LaTeX string ‘J"org’s Data’ – PyXPlot recognises the backslash character to be an escape character when followed by either ’ or " in a LaTeX string. This is the only case in which PyXPlot considers
an escape character. To render the example string above, one would type:
set xlabel "J\\"org's Data"
In this example, two backslashes are required. The first is the LaTeX escape character used to produce the umlaut; the second is a PyXPlot escape character, used so that the " character is not interpreted as delimiting the string.
Having set labels and titles, they may be removed thus:
set xlabel '' set ylabel '' set title ''
These are two other ways of removing the title from a plot:
set notitle unset title
The unset command may be followed by almost any word that can follow the set command, such as xlabel or title, to return that setting to its default configuration. The reset command restores all configurable parameters to their default states.