2.2 First Plots

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 $\sin (x)$:

plot sin(x)

It is also possible to plot data from files. The following would plot data from a file ‘datafile’, taking the $x$-coordinate of each point from the first column of the datafile, and the $y$-coordinate from the second. The datafile is assumed to be in plain text format, with columns separated by whitespace and/or commasIf the filename of a datafile ends with a .gz suffix, it is assuming to be gzipped plaintext, and is decoded accordingly.:

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) =