c++qtdata-visualizationvtkqvtkwidget

Add error bars to a VTK 2D scatter plot


Is there a way to add error bars to scatter plot data using VTK? I am currently plotting point data using the C++ API; there is uncertainty associated with the data I am trying to plot which I would like to visualise also.

I can't find any obvious references in the documentation to error bars; the only mention I have found is in this Kitware presentation from 2011, which doesn't seem to be a function that exists.

Sample code snippet:

// Chart source data is populated etc...

vtkPlot* sampleScatter = chartXY->AddPlot(vtkChart::POINTS);
sampleScatter->SetInputData(chartDataTable, 0, 1);
// Here is where I would like to add the error bars - 
// below method is from the link, and does not work
vtkPlotPoints::SafeDownCast(sampleScatter)->SetErrorArray(errorData.GetPointer());

// Chart is rendered...

where chartXY is a vtkChartXY object and chartDataTable is a vtkTable containing the x and y data in columns 0 and 1.

Is there a way to populate error data for visualisation in a similar fashion to the above, or will I have to roll my own chart type?


Solution

  • It turns out that this is not a capability that exists in VTK at the moment.

    I have developed a basic capability to do this, which is currently the subject of a merge request in the VTK repository. Will update if/when this has been merged in and the capability is available.