CPlotView:AddPoints


The AddPoints method plots data held in the class data matrix. The data matrix is a CMatrix that can hold one or more series of x,y data as well as y error bars and x,y error bars. The illustration below shows all three types of matrix data.

Syntax

CPlot, nSeries = CPlotView:AddPoints()

bullet.gif    On success, CPlot is a new CPlot object attached to the plot series at index nSeries. On failure, nil, 0 is returned.

Scatter plot showing 8 (x,y) points plus 4 additional points with error bars added using the present method. All 12 points could have been plotted at one time.

Remarks

This method adds data points to the current series. All the points in the class data matrix are added. To set the current plot series, use SetIndex.

Example

Assume that a CPlotView V exists and is attached to the window shown above. The script below added the 4 points with error bars to the plot window:

 

V:SetIndex(2)

-- select the plot series

V:Empty()

-- clear existing data from the data matrix

V:Add( 38.52, 70.5, 3, 12)

-- x, y, xerrorbar, yerrorbar

V:Add( 22.52, 150.5, 5, 8)

-- x, y, xerrorbar, yerrorbar

V:Add( 30.5, 120.22, 8)

-- x, y, yerrorbar

V:Add( 46.5, 90, 16.5)

-- x, y, yerrorbar

V:AddPoints()

-- add the data matrix

Related Topics

CPlotView class, PlotPoints, AddSeries


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