Data may be graphed using the plot(x,y)-function, x and y being equalsized vectors, which denote the coordinates of the data points to be plotted. A third optional argument plot(x,y,option) specifies plot options like colors and symbols. The graphic may then be decorated (axis, title) and exported as encapsulated-postscript file for inclusion in text documents. With hold (or hold on) the graphic gets locked so that subsequent plot commands use the same window. Repeating hold (or hold off) deletes the graphic.
plots x versus y using option x and y are equalized vectors. option is a string, specifying color (one of r,g,b,y,m,c,w,k) and symbol (one of +,*,o,x). Default: blue lines.
Logarithmic and semi-logarithmic plots are provided with the functions loglog, linlog and loglin.
Here are the major plot methods:
|plot(x,y [option])||Plot x versus y|
|loglog(x,y [option])||logarithmic plot|
|linlog(x,y [option])||semi-logarithmic plot|
|loglin(x,y [option])||semi-logarithmic plot|
|print(name )||write graphic in eps-file|
Let as show a simple example of plotting sin(x) between 0 and 10 with a step 0.1
However, one can overlay these plots using the “hold” method:
You can plot symbols as well:Run this plot to see its output.
Now let us draw data points with errors and overlay a Gaussian function $y = A*\exp(-1)
x 0 1 2 3 4 5 6 7 8 9 y -3.1 -0.7 1.8 4.1 6.2 8.9 11.3 13.5 16 18.3