CPlotView:PlotMatrix


The PlotMatrix method plots all of the rows of a CMatrix using symbols. Each row of the matrix is plotted as a different plot series.

Syntax

CPlot = CPlotView:PlotMatrix( CMatrix )

CPlot = CPlotView:PlotMatrix( CMatrix, sX )

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

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

CPlot = CPlotView:PlotMatrix( 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. It is nil on failure.

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 38 were plotted from row 11 through 14. The 3 series are shown in different colors and are over-plotted in this view.

Remarks

This method plots all of the rows of a sparse matrix stored in a CMatrix. The sparse matrix is filled with members that consist of a row and column index and a value. 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. Holes are filled with 0's, which can be seen in the sparse plot data plotted in window shown above.

To plot the same data as connected lines rather than as discrete symbols, use the PlotMatrixLine method. To plot a range of rows or a single row, use the PlotMatrixRange method.

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.

A = new_matrix()

-- create a new CMatrix

A:Set(11,24,10)

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

  ... add more ...

-- add more points and other rows

P = new_plotview()

-- create a new CPlotView

P:PlotMatrix(A)

-- create the symbol plot

Related Topics

CPlotView class, PlotMatrixRange, PlotMatrixLine, CMatrix


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