Linear plot.
plot(x,y)
plots vector y
versus vector x
.
If x
or y
is a
Tensor
of size either m x 1 or 1 x m,
then the vector is plotted versus the rows or columns of the matrix,
whichever line up.
Alternatively, x and y can be of type
Lua
table
.
plot(y)
plots the columns of y
versus their index.
Various line types, plot symbols and colors may be obtained with
plot(x,y,s)
where s is a character string made from one element
from any or all the following 3 columns:
y yellow . point - solid m magenta o circle : dotted c cyan x cross r red + plus g green * star b blue s square w white d diamond k black p current pen color T text
For example, plot(x,y,'c+:')
plots a cyan dotted line with a plus
at each data point; plot(x,y,'bd')
plots blue diamond at each data
point but does not draw any line.
The plot
command also returns a handle to the drawn object which can be used to delete
it, e.g:
w=gfx.Window() p1=w:plot(1,1,'bx') p2=w:plot(1,1,'go') w:delete(p1)
One can also plot text using the following method:
w=gfx.Window() w:plot({0,1,2,3},{0,1,2,3},'bThello')Anything after the 'T' in the argument line will be used as text and sets the markerText property of the window.