CPlotView:PlotMatrixLine


The PlotMatrixLine method makes a connected line plot from all of the rows of a CMatrix. Each row is plotted as a separate plot series.

Syntax

Note: All parameters with * are optional and must be specified in the order shown.

bSuccess = CPlotView:PlotMatrixLine( CMatrix, sX*, sY*, sTitle*, sCap* )

    CMatrix is a matrix holding the data to plot. All lines (rows) are plotted.

    sX is the optional x axis label.

    sY is the optional y axis label..

    sTitle is the optional window title.

    sCap is the optional plot caption.

    bSuccess is the returned success code. On success it is true, otherwise false.

 

Line plot using default labels for x axis, y axis, title, and caption. The CMatrix contains one line, which is row 11. The caption above the plot box shows that columns 22 through 42 were plotted from row 11.

  

This method plots all of the rows of a sparse matrix using the CMatrix class. The sparse matrix is filled with members that consist of a row and column index and a value. To plot a range of rows, or only a single row, use the PlotMatrixRangeLine method. The fact that the CMatrix is sparse means that every cell does not have to be populated. In other words, indices do not need to exist between 1 and the minimum column or between 1 and the minimum row. Similarly, the matrix may have "holes" between minimum column and maximum column. For example, the picture above shows a plot made from 4 points existing in a 1-row matrix (see the data in the example, below).

Example

The plot window above shows 4 data points having y=11 in the range x=22 to x=42. The data and plot were generated by the following script. Note: we equate "x" to column index and "y" to row index.

 

A = CMatrix:new()

-- create a new CMatrix

A:Set( 11, 24, 10)

-- add a point at y=11, x=24, value= 10

A:Set( 11, 22, 12)

-- add a point at y=11, x=22

A:Set( 11, 42, 1)

-- add a point at y=11, x=42

A:Set( 11, 25, 15)

-- add a point at y=11, x=25

P = CPlotView:new()

-- create a new CPlotView

P:PlotMatrixLine(A)

-- create the line plot

Related Topics

CPlotView class, PlotMatrix, PlotMatrixRangeLine, CMatrix class