VTKFIG  0.20.20181114
Easy VTK based in situ visualization
template<typename V >
void vtkfig::XYPlot::AddPlot ( const V &  x,
const V &  y 
)
inline

Add a pair of x/y data to the figure.

Template Parameters
VVector class counting from zero with member functions size() and operator[]. std::vector will work.
Parameters
xvector of x values
yvector of y values

Definition at line 285 of file vtkfigXYPlot.h.

286  {
287 
288  while (num_plots>=AllPlotData.size())
289  {
290  AllPlotData.emplace_back(XYPlotActor,num_curves);
291  }
292  auto plot=AllPlotData[num_plots];
293 
294  int N=x.size();
295  assert(x.size()==y.size());
296 
297  plot.X->SetNumberOfTuples(N);
298  plot.Y->SetNumberOfTuples(N);
299 
300  double xmin=1.0e100;
301  double xmax=-1.0e100;
302  double ymin=1.0e100;
303  double ymax=-1.0e100;
304 
305 
306  for (int i=0; i<N; i++)
307  {
308  plot.X->InsertTuple1(i,x[i]);
309  plot.Y->InsertTuple1(i,y[i]);
310  xmin=std::min(xmin,x[i]);
311  ymin=std::min(ymin,y[i]);
312  xmax=std::max(xmax,x[i]);
313  ymax=std::max(ymax,y[i]);
314  }
315 
316  PlotState.dynXMin=std::min(xmin,PlotState.dynXMin);
317  PlotState.dynXMax=std::max(xmax,PlotState.dynXMax);
318  PlotState.dynYMin=std::min(ymin,PlotState.dynYMin);
319  PlotState.dynYMax=std::max(ymax,PlotState.dynYMax);
320 
321  AddPlot();
322  }
void AddPlot()
Internal addplot after plot data have been filled.
double xmin
View volume data.
Definition: vtkfigFigure.h:412
struct vtkfig::XYPlot::@4 PlotState
General state of the XYPlot.
vtkSmartPointer< vtkXYPlotActor > XYPlotActor
The main graphics actor.
Definition: vtkfigXYPlot.h:175
int num_curves
Number of all curves including grid lines.
Definition: vtkfigXYPlot.h:172
size_t num_plots
Number of "real" plots.
Definition: vtkfigXYPlot.h:166
std::vector< PlotData > AllPlotData
vector holding data of all plots
Definition: vtkfigXYPlot.h:227

+ Here is the call graph for this function: