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

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

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

where

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

  

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 data array 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. 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

  -- add more --

-- add more points and other rows

P = CPlotView:new()

-- create a new CPlotView

P:PlotMatrix(A)

-- create the symbol plot

Related Topics

CPlotView class, PlotMatrixRange, PlotMatrixLine, CMatrix class