ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Error bars for both x and y
Posted by Stan on Mar-05-2011 05:39
Attachments:
Hi Peter,

How do I make a scatterplot where there are error-bars for both the x and y values?

Thanks,
Stan
leaf-GE_BrightCorner.png

  Re: Error bars for both x and y
Posted by Peter Kwan on Mar-06-2011 23:30
Hi Stan,

For the vertical error bars, you can use a normal box-whisker layer, like in the "Line with Error Symbols" sample code.

For the horizontal error bars, you may use a scatter layer in which the scatter symbol is an "H" shape. By configuring the width of the symbols without modifying their height (by using SetSymbolScale), you can create the horizontal error bars.

For example, in VB/VBScript:

'dataX and dataY are arrays that contain the center (x, y) of the symbols
Set layer = c.addScatterLayer(dataX, dataY)

'Set the symbol shape to be an "H" shape
Call layer.getDataSet(0).setDataSymbol4(array(-500, 0, -500, 1000, -500, 500, 500, 500, 500, 1000, 500, 0, 500, 500, -500, 500), 11, &H0000ff, &H0000ff)

'Set the widths of the symbols in the same units as the x-axis scale. For the height,
'you may use a constant array in which all elements are of the same values, which are
'the pixel height of the symbol
Call layer.setSymbolScale(widthArray, cd.XAxisScale, heightArray, cd.PixelScale)

Hope this can help.

Regards
Peter Kwan

  Re: Error bars for both x and y
Posted by Stan on Mar-20-2011 08:54
Works fine in python too.

Thanks.