Dear All,<br><br>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.<br>
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. <br><br>Maybe I am doing something wrong?<br><br>Please advise!<br><br>Many thanks,<br>
Adrian<br><br><br> vtkImageData *myPlot = vtkImageData::New ();<br> myPlot->SetNumberOfScalarComponents (2);<br> myPlot->Initialize();<br> myPlot->SetSpacing(1.0, 0.0, 0.0);<br> myPlot->SetDimensions (v->GetNumberOfTuples (), 1, 1);<br>
myPlot->SetOrigin(1.0, 0.0, 0.0);<br> myPlot->GetPointData ()->SetScalars (g);<br><br> vtkXYPlotActor* profile = vtkXYPlotActor::New();<br> profile->AddInput(myPlot);<br> profile->SetPlotColor (1, 1, 0, 0);<br>
profile->SetPlotColor (0, 0, 0, 1);<br> profile->GetPositionCoordinate()->SetValue( 0.05, 0.05, 0);<br> profile->GetPosition2Coordinate()->SetValue( 0.95, 0.95, 0);<br> profile->SetNumberOfXLabels(10);<br>
profile->SetDataObjectXComponent (0, 0);<br> profile->SetDataObjectYComponent (0, 1);<br> profile->SetXValuesToValue ();<br> profile->SetPointComponent (0, 1);<br> profile->SetTitle( "g(v)" );<br>
profile->SetXTitle( "v");<br> profile->SetYTitle( "g(v)");<br> profile->GetProperty()->SetColor( 0, 0, 0);<br> profile->GetProperty()->SetLineWidth( 2);<br> profile->SetLabelFormat("%g");<br>
vtkTextProperty* tprop = profile->GetTitleTextProperty();<br> tprop->SetColor(0.02,0.06,0.62);<br> tprop->SetFontFamilyToArial();<br> tprop->SetFontSize (30);<br> profile->SetAxisTitleTextProperty(tprop);<br>
profile->SetAxisLabelTextProperty(tprop);<br> profile->SetTitleTextProperty(tprop);<br clear="all"><br>-- <br>---------------------------------------------------<br>Adrian Albert<br>School of Engineering and Science<br>
Jacobs University Bremen<br>Germany<br>Tel.: 00494212003258