CPlotView:AddMatrixRange CPlotView:PlotMatrixRangeLine

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

bSuccess = CPlotView:PlotMatrixLine( CMatrix, sX=nil, sY=nil, sTitle=nil, sCaption=nil )

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.

Remarks

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, PlotMatrix, PlotMatrixRangeLine, CMatrix