3.3.3 Plot Error Bar


Version Info

Minimum Origin Version Required: Origin 7.5

Methods

Adds an error bar plot to an existing dataplot from Column object or Datast object. Please refer to GraphLayer::AddErrBar for more information.

Example

void plot_error_bar()
{
	Worksheet wks;
	wks.Create("origin");
	wks.AddCol();
	wks.SetColDesignations("XYE");
	Dataset dsX(wks, 0);
	Dataset dsY(wks, 1);
	Dataset dsErr(wks, 2);
	
	int nSize = 100;
	dsX.Data(1, nSize, 1);
	dsY.Data(1, nSize, 1);
	dsErr.SetSize(nSize);
	dsErr = rnd();

	GraphPage gp;
	gp.Create();
	GraphLayer lay = gp.Layers(0);
	
	// add a dataplot in the layer that uses column B as Y and column A as X			
	Curve		cc(wks, 0, 1);
	int		nPlotIndex = lay.AddPlot(cc, IDM_PLOT_SCATTER);
	out_int("nPlotIndex = ", nPlotIndex);
			
	// use the third column in the worksheet for error bar:
	Column	colErrBar(wks, 2);	
	
	int		nErrPlotIndex = lay.AddErrBar(cc, colErrBar);
	out_int("nErrPlotIndex = ", nErrPlotIndex);
			
}

Related Methods

And also support method to plot X error bar and label. Please refer to GraphLayer::AddXErrBar and GraphLayer::AddLabelPlot for more details.