8.5 Plotting functions in exotic styles

The use of plot styles which take more than two columns of input data to plot functions requires more than one function to be supplied. When functions are plotted with syntax such as

plot sin(x) with lines

two columns of data are generated: the first contains values of $x$ – plotted against the horizontal axis – and the second contains values of $\sin (x)$ – plotted against the vertical axis. Syntax such as

plot f(x):g(x) with yerrorbars

generates three columns of data. As before, the first contains values of $x$. The second and third contain samples from the colon-separated functions $f(x)$ and $g(x)$. Specifically, in this example, $g(x)$ provides the uncertainty in the value of $f(x)$. The using modifier may also be used in combination with such syntax, as in

plot f(x):g(x) using 2:3

though this example is not sensible. $g(x)$ would be plotted on the y-axis, against $f(x)$ on the x-axis. However, this is unlikely to be sensible because the range of values of $x$ substituting into these expressions would correspond to the range of the plot’s horizontal axis. The result might be particularly unexpected if the above were attempted with an autoscaling horizontal axis – Pyxplot would find itself autoscaling the x-axis range to the spread of values of $f(x)$, but find that this itself changed depending on the range of the x-axis. In this case, the user should have used the parametric plot option described in the next section.