lineerr


The lineerr function creates a line plot by drawing line segments between data points. This is non-class equivalent of the CPlotView:Line method. The x and y points at the same array index are presumed to correspond to the same point. The data for x, y, x error bars, and y error bars are each held in lua arrays (1-dimensional indexed tables). To plot without errorbars, use line.

This function creates a new plot window and returns a CPlotView object and CPlot object for the plot window and plot series it creates. This object can be used to enhance or add to the plot or extract plot data for further analysis.

Syntax

CPlotView, CPlot = lineerr( x, y, xe, ye )

CPlotView, CPlot = lineerr( x, y, xe, ye, sLabelX )

CPlotView, CPlot = lineerr( x, y, xe, ye, sLabelX, sLabelY )

CPlotView, CPlot = lineerr( x, y, xe, ye, sLabelX, sLabelY, sCaption )

CPlotView, CPlot = lineerr( x, y, xe, ye, sLabelX, sLabelY, sCaption, sWindowTitle )

bullet.gif    x is a 1-dimensional array containing the x values.

bullet.gif    y is a 1-dimensional array containing the x values.

bullet.gif    xe is an optional 1-dimensional array containing the x error bar values.

bullet.gif    ye is an optional 1-dimensional array containing the y error bar values.

bullet.gif    sLabelX is an optional label for the x axis.

bullet.gif    sLabelY is an optional label for the y axis.

bullet.gif    sCaption is an optional plot caption.

bullet.gif    sWindowTitle is an optional plot window title.

bullet.gif    Parameters that are nil or missing to the right adopt default values.

Return Values:

bullet.gif    CPlotView is a new CPlotView object attached to the plot window. It is nil on failure.

bullet.gif    CPlot is a new CPlot object attached to the current plot series. It is nil on failure.

Remarks

This function creates a quick plot using just one line of code. The returned values of V and P provide access to the plot window and plotted data. You can also change the plot properties including the marker attributes, labels, scaling, and others using commands such as Series Attributes and Plot Attributes.

Only the first 4 arguments, the (x,y) data, are required. If you want to use the other arguments, you must include a placeholder to fill any holes between the arguments. For example, to include y error bars but not x error bars, use nil in place of the xe parameter.

Examples

The script below plots x, y, and y error bars with axis labels and error bars on the y axis.

x = random( 10, 10, 20 )

-- 10 values between 10 and 20

y = random( 10, 20, 40 )

-- 10 values between 20 and 40

ye = random( 10, 1, 3 )

-- 10 values between 1 and 3

line( x, y, nil, ye, "My X", "My Y" )

-- create the line plot

Related Topics

line

plot

scatter

connect

stepline

CPlotView class

Plotting Functions

Comparison of non-Class Plotting Functions


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