figure(H) makes H the current figure, forces it to become visible, and raises it above all other figures on the screen. If Figure H does not exist, and H is an integer, a new figure is created with handle H.
axes Create axes in arbitrary positions. axes('position', RECT) opens up an axis at the specified location and returns a handle to it. RECT = [left, bottom, width, height] specifies the location and size of the side of the axis box, relative to the lower-left corner of the Figure window, in normalized units where (0,0) is the lower-left corner and (1.0,1.0) is the upper-right.
axis([XMIN XMAX YMIN YMAX]) sets scaling for the x- and y-axes on the current plot.
axis off turns off all axis labeling, tick marks and background.
axis on turns axis labeling, tick marks and background back on.
plot(X,Y) plots vector Y versus vector X. If X or Y is a matrix, then the vector is plotted versus the rows or columns of the matrix, whichever line up.
plot(Y) plots the columns of Y versus their index.
hold on holds the current plot and all axis properties so that subsequent graphing commands add to the existing graph.
Plot annotations: xlabel('text') adds text beside the X-axis on the current axis. ylabel('text') adds text beside the Y-axis on the current axis. legend(string1,string2,string3, ...) puts a legend on the current plot using the specified strings as labels. title('text') adds text at the top of the current axis.
print -deps2 filename.eps saves the current plot as Encapsulated Level 2 PostScript file
Other plot commands: mesh, surf, bar, hist, ...
n = 20;
for j = 1:n
if isprime(j)
a(j) = j^2;
else
a(j) = 1/j;
end
end
| Christian Toepfer | |
| Last modified: Tue Apr 25 13:08:41 MET DST 2000 |