CPlotView:AddSeries


The AddSeries method appends the class data matrix as a new plot series in the current plot window.

Syntax

CPlot, nSeries = CPlotView:AddSeries( sCaption=nil )

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

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 in the first series and 4 points with errorbars in the second series.

Remarks

This method expects the target plot window to exist and contain at least one series. To the existing series is then added the entire contents of the class data matrix as 1 new series. In comparison, the AddPoints method adds the class data matrix to those already in the current plot series.

Example

Assume that a CPlotViewV exists and is attached to the window shown above. The script below added the 4 points with error bars as a new series in the window:

 

V:Empty()

-- clear existing data from the array

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:AddSeries()

-- add the data as a new series

Related Topics

CPlotView class, AddPoints, PlotPoints


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