ploterr
The ploterr function is an alias for the connecterr function provided for compatibility with older scripts. This is an efficient non-class equivalent to the CPlotView:PlotConnected method. It creates a marker plot with lines connecting the markers. The x and y data points come from separate arrays in which the x and y points at the same array index are presumed to define a point. This function also can plot x and y error bars. This function creates a new plot window and returns a CPlotView object and a CPlot object for the plot and the plot series it creates. These objects can be used to enhance or add to the plot or extract plot data for further analysis. There are four similar versions of this command as shown in the Comparison of non-class plotting functions.
CPlotView, CPlot = ploterr( x, y )
CPlotView, CPlot = ploterr( x, y, xe )
CPlotView, CPlot = ploterr( x, y, xe, ye )
CPlotView, CPlot = ploterr( x, y, xe, ye, sLabelX )
CPlotView, CPlot = ploterr( x, y, xe, ye, sLabelX, sLabelY )
CPlotView, CPlot = ploterr( x, y, xe, ye, sLabelX, sLabelY, sCaption )
CPlotView, CPlot = ploterr( x, y, xe, ye, sLabelX, sLabelY, sCaption, sWindowTitle )
x is a 1-dimensional array containing the x values.
y is a 1-dimensional array containing the x values.
xe is an optional 1-dimensional array containing the x error bar values.
ye is an optional 1-dimensional array containing the y error bar values.
sLabelX is an optional label for the x axis.
sLabelY is an optional label for the y axis.
sCaption is an optional plot caption.
sWindowTitle is an optional plot window title.
Parameters that are nil or missing to the right are assigned default values.
Return values:
CPlotView is a new CPlotView object attached to the plot window. It is nil on failure.
CPlot is a new CPlot object attached to the current plot series. It is nil on failure.
This function creates a quick plot using just one line of code. The returned values of V and P provide access to the CPlotView window and current CPlot buffer. You can also change the plot properties including the marker and line attributes, labels, scaling, and others using commands such as Series Attributes and Plot Attributes.
Only the first 2 arguments, the (x,y) data, need be provided to create the plot, which is redundant with the plot function. If you want to use the other arguments, you must use placeholders, like 0 or nil, to fill holes between the missing arguments.
The script below creates some data from the random number generator and creates a scatter plot with default plot labels. There is o x error bar, so it is passed as the value nil.
|
-- 10 values between 10 and 20 |
|
-- 10 values between 20 and 40 |
|
-- 10 values with standard deviation 5.,0 |
|
-- create the plot. There is no x errorbar |
The second example, below, repeats the above plot but adds axis labels and error bars on the y axis.
|
-- 10 values between 10 and 20 |
|
-- 10 values between 20 and 40 |
|
-- 10 values with standard deviation 5.,0 |
|
-- create the connected line plot |
Comparison of non-Class Plotting Functions
Mira Pro x64 Script User's Guide, v.8.73 Copyright Ⓒ 2024
Mirametrics, Inc. All Rights Reserved.