CPlotView:PlotPoints
The PlotPoints method draws points from the class data matrix in a new plot window. This method can plot markers, lines, and errob bars for both axes. The illustration below shows only (x,y) pairs without errorbars.
Note: All parameters with * are optional and must be specified in the order shown.
bSuccess = CPlotView:PlotPoints( sX*, sY*, sTitle*, sCap* )
sX is the optional x axis label.
sY is the optional y axis labe.
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.
The first plot below shows a simple scatter plot without error bars. This plot was generated using the first sample script in the Examples, below. The legend was turned off
The plot below was generated using the second script in the Examples..
To plot the same data as connected lines rather than as discrete symbols, use the PlotDataLine method. To plot a range of rows or a single row, use the PlotDataRange method.
This method plots all points in the class data matrix as a single series in a plot window. Data points are drawn as symbols as shown above.
The sCap argument becomes the default text for the plot legend. The caption or legend may later be changed using SetCaption and SetLegendText.
The script below created the plot window shown above. Although this example shows simple (x,y) points, y errorbars or x,y errorbars could have been plotted by adding them their extra arguments in the Add method.
|
-- create a new CPlotView |
|
-- add point 1: x=5.62, y=100.5 |
|
-- add other points |
|
|
|
|
|
|
|
|
|
|
|
|
-- make the plot |
|
|
The next example is far more sophisticated but only a little more complicated. This example uses all 5 arguments for the Add method, which includes the draw mode for each point (e.g., move to, line to, marker, etc.). The script adds points into 2 data series and displays them simultaneously in "over plot" mode. Error bars are included in the first series. This script generated the plot shown above.
|
|
|
-- add marker (with error bars) |
|
-- line to point |
|
-- line to point |
|
-- line to [pomt with error bars |
|
-- add marker with error bars |
|
-- line to marker |
|
-- add marker with error bar |
|
-- line to point with error bars |
-- display the points in a new plot window |
|
|
|
|
|
|
-- emove data points already defined |
|
-- add all points as "LineToMarker" |
|
|
|
|
|
|
|
|
|
|
|
-- add these 6 points as a new series |
|
|
|
-- add legend at bottom |
|
-- change to "overplot" mode. |
CPlotView, PlotMatrix, PlotDataLine, AddPoints, SetCaption, SetLegendText