The basic workhorse command of PyXPlot is the plot command, which is
used to produce all plots. The following simple example would plot the function
:
plot sin(x)
It is also possible to plot data from files. The following would plot
data from a file `datafile', taking the
-coordinate of each point
from the first column of the datafile, and the
-coordinate from the second.
The datafile is assumed to be in plain text format, with columns separated by
whitespace and/or commas2.1:
plot 'datafile'
Several items can be plotted on the same graph by separating them by commas:
plot 'datafile', sin(x), cos(x)
It is possible to define one's own variables and functions, and then plot them:
a = 2 b = 1 c = 1.5 f(x) = a*(x**2) + b*x + c plot f(x)
To unset a variable or function once it has been set, the following syntax should be used:
a = f(x) =
Labels can be applied to the two axes of the plot, and a title put at the top:
set xlabel 'This is the X axis' set ylabel 'This is the Y axis' set title 'A Plot of sin(x)' plot sin(x)
All such text labels are displayed using LATEX, and so any LATEXcommands can be used, for example to put equations on axes:
set xlabel '$\frac{x^2}{c^2}$'
As a caveat, however, this does mean that care needs to be taken to
escape any of LATEX's reserved characters - i.e.:
& % # { } $ _ ^ or
.
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 essentially 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.
Dominic Ford 2006-09-09