3.6 Axis labels and titlesLabels can be added to the axes of a plot, and a title put at the top. As with any other strings (see the previous section), labels should be enclosed in either single (’) or double (") quotes, as in the following example script: set xlabel "Horizontal axis" set ylabel "Vertical axis" set title 'A plot with labelled axes' plot ![]() These labels and title – in fact, all text labels which are ever produced by Pyxplot – are rendered using the latex typesetting system, and so any latex commands can be used to produce custom formatting. This allows great flexibility, but means that care needs to be taken to escape any of latex’s reserved characters – i.e. Two built-in functions provide some assistance in generating latex labels. The texify() function takes as its argument a string containing a mathematical expression, and returns a latex representation of it. The texifyText() function takes as its argument a text string, and returns a latex representation of it, with any necessary escape characters added. For example: pyxplot> print texify("sqrt(x**2+1)") Special care needs to be taken when typesetting latex expressions that contain apostrophe or quote characters, as these are the string delimiters used by Pyxplot. For ease, it is recommended that latex expressions be enclosed in triple quotes:
The reason for recommending this syntax is demonstrated by the examples below, all of which will fail. In
the apostrophe will be mis-interpreted as a closing quote character. In
the backslash before the " character, intended to be the latex control string for an umlaut ( set xlabel "J\\\"org's data" this syntax is messy, as the backslashes are confusing to the eye. It is much neater to use (see Section 3.5 for an explanation of string escaping):
There are similar problems with
where the
|