CPlotView:PlotMatrixLine CPlotView:AddMatrixRangeLine

CPlotView:PlotMatrixRangeLine


The PlotMatrixRangeLine method plots a range of lines of data stored in the rows of a CMatrix. This method uses an external matrix, not the class data matrix. Each line creates a different plot series.

Syntax

bSuccess = CPlotView:PlotMatrixRangeLine( CMatrix, y1, y2, sX=nil, sY=nil, sTitle=nil, sCaption=nil )

Line Plot window using default x label, y label, title, and caption. The caption above the plot box shows that data in columns 22 42 and rows 12 through 14 were plotted. The 3 rows were plotted in 3 series using different colors (black, red, green). There were no points in row 14.

Remarks

This method make a connected line plot from a range of rows in a CMatrix. Alternatively, you can make the same type of plot, but with symbols instead of connect lines, using the PlotMatrixRange method. In comparison, the PlotMatrixLine and PlotMatrix methods plot all rows of the matrix, rather than a range of rows.

The plotted data come from a sparse CMatrix. The matrix contains values at (column,row) indices. The matrix rows are not required to have the same beginning and ending columns. Every row does not have to exist in the plotted range, nor does every column need a value. Holes are automatically set to 0. For example, the picture above shows a plot made from 4 points existing in the first row of a small matrix (see the example, below).

Example

The plot window above shows 3 data points plotted with only 1 point in each of the 3 series. These points were plotted from rows 12, 13, and 14 in a matrix containing 8 points in the rectangle [22:42, 11:16] (note: this is [column:column, row:row notation]). Points in rows 11, 15, and 16 were ignored and no point exists in row 14, which lies in range. The x-axis scaling extends from column 22 through 38 because that is the region covered by the matrix. The data and plot were generated by the following script:

A = CMatrix:new()

-- create a new CMatrix

A:Set( 16, 22, 1)

-- add a point at y=16, x=22, value= 1

A:Set( 11, 24, 10)

-- add other points

A:Set( 12, 25, 1)

 

A:Set( 13, 27, 6)

 

A:Set( 11, 22, 12)

 

A:Set( 13, 38, 4)

 

A:Set( 12, 28, 19)

 

A:Set( 11, 25, 15)

 

P = CPlotView:new()

-- create a new CPlotView

P:PlotMatrixRangeLine(A,12,14)

-- create the line plot

Related Topics

CPlotView, PlotMatrixLine, PlotMatrix, PlotMatrixRange, AddMatrixRangeLine, CMatrix