A directed graph can be plotted by using triangle markers, in this case right facing triangle marker.
y = [1, 3, 2, 4, 5, 1];
plot(1:length(y), y, '->')
Lines on a graph can be labeled using the legend command with the label typed out in the form of a string. Multiple lines can be labeled within the same legend command by typing multiple strings separated by commas. The lines will be labeled in the order they are plotted so the first string will label the first line plotted, the second string the second line plotted, etc.
x = linspace(0, 8 * pi);
plot(x, sin(x))
legend('My Text')