Graphics Previous page   Next Page

Line Plots of Matrix Data

When you call the plot function with a single matrix argument

MATLAB draws one line for each column of the matrix. The x-axis is labeled with the row index vector 1:m, where m is the number of rows in Y. For example,

returns a 49-by-49 matrix obtained by evaluating a function of two variables. Plotting this matrix

produces a graph with 49 lines.

The graph shows each column plotted as one line. The axes ColorOrder property determines the color of each line as MATLAB cycles through the list of colors.

In general, if plot is used with two arguments and if either X or Y has more than one row or column, then

You can also use the plot function with multiple pairs of matrix arguments.

This statement graphs each X-Y pair, generating multiple lines. The different pairs can be of different dimensions.


Previous page  Setting Default Line Styles Plotting Imaginary and Complex Data Next page

© 1994-2005 The MathWorks, Inc.