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

CPlot = CPlotView:PlotMatrixLine( CMatrix )

CPlot = CPlotView:PlotMatrixLine( CMatrix, sX )

CPlot = CPlotView:PlotMatrixLine( CMatrix, sX, sY )

CPlot = CPlotView:PlotMatrixLine( CMatrix, sX, sY, sTitle )

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

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

bullet.gif    sX is the optional x axis label. If nil, a default is used.

bullet.gif    sY is the optional y axis label. If nil, a default is used.

bullet.gif    sTitle is the optional window title. If nil, a default is used.

bullet.gif    sCaption is the optional plot caption. If nil, a default is used.

Return value:

bullet.gif    CPlot is a new CPlot object attached to the current plot series.

The picture below shows a line plot using default labels for x axis, y axis, title, and caption. For this plot, the CMatrix contains one line, which is row 11 as indicated in the plot caption. The caption also indicates 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 = new_matrix()

-- 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 = new_plotview()

-- create a new CPlotView

P:PlotMatrixLine(A)

-- create the line plot

Related Topics

CPlotView class

PlotMatrix

PlotMatrixRangeLine

CMatrix


Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics, Inc. All Rights Reserved.