[vtkusers] error in vtkXYPlotActor?

Adrian Albert a.albert at jacobs-university.de
Fri May 2 07:30:18 EDT 2008


Dear All,

I was wondering if there was a bug in vtkXYPlotActor that doesn't allow one
to plot field data (2 components) by specifying that the x axis should get
the values from component 0 and the y axis from component 1 of the field. My
code is at the end of this email.
It seems that vtkXYPlotActor doesn't do what it should when I tell it to use
component 0 as x values and component 1 as y values.

Maybe I am doing something wrong?

Please advise!

Many thanks,
Adrian


  vtkImageData *myPlot = vtkImageData::New ();
  myPlot->SetNumberOfScalarComponents (2);
  myPlot->Initialize();
  myPlot->SetSpacing(1.0, 0.0, 0.0);
  myPlot->SetDimensions (v->GetNumberOfTuples (), 1, 1);
  myPlot->SetOrigin(1.0, 0.0, 0.0);
  myPlot->GetPointData ()->SetScalars (g);

  vtkXYPlotActor* profile = vtkXYPlotActor::New();
  profile->AddInput(myPlot);
  profile->SetPlotColor (1, 1, 0, 0);
  profile->SetPlotColor (0, 0, 0, 1);
  profile->GetPositionCoordinate()->SetValue( 0.05, 0.05, 0);
  profile->GetPosition2Coordinate()->SetValue( 0.95, 0.95, 0);
  profile->SetNumberOfXLabels(10);
  profile->SetDataObjectXComponent (0, 0);
  profile->SetDataObjectYComponent (0, 1);
  profile->SetXValuesToValue ();
  profile->SetPointComponent (0, 1);
  profile->SetTitle( "g(v)" );
  profile->SetXTitle( "v");
  profile->SetYTitle( "g(v)");
  profile->GetProperty()->SetColor( 0, 0, 0);
  profile->GetProperty()->SetLineWidth( 2);
  profile->SetLabelFormat("%g");
  vtkTextProperty* tprop = profile->GetTitleTextProperty();
  tprop->SetColor(0.02,0.06,0.62);
  tprop->SetFontFamilyToArial();
  tprop->SetFontSize (30);
  profile->SetAxisTitleTextProperty(tprop);
  profile->SetAxisLabelTextProperty(tprop);
  profile->SetTitleTextProperty(tprop);

-- 
---------------------------------------------------
Adrian Albert
School of Engineering and Science
Jacobs University Bremen
Germany
Tel.: 00494212003258
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080502/e8c4370c/attachment.htm>


More information about the vtkusers mailing list