You can directly use vtkXYPlotActor to get a plot of 2 arrays .<br><br>Here is a simple example to plot a array .<br>vtkSmartPointer&lt;vtkXYPlotActor&gt; plot = vtkSmartPointer&lt;vtkXYPlotActor&gt;::New();<br>    plot-&gt;ExchangeAxesOff();<br>
    plot-&gt;SetLabelFormat( &quot;%g&quot; );<br>    plot-&gt;SetXTitle( &quot;Level&quot; );<br>    plot-&gt;SetYTitle( &quot;Frequency&quot; );<br>    plot-&gt;SetXValuesToIndex();<br><br>for ( i = 0 ; i &lt; 2 ; i++)<br>
{<br>        vtkSmartPointer&lt;vtkDoubleArray&gt; array_s = vtkSmartPointer&lt;vtkDoubleArray&gt;::New();<br>        vtkSmartPointer&lt;vtkFieldData&gt; field = vtkSmartPointer&lt;vtkFieldData&gt;::New();<br>        vtkSmartPointer&lt;vtkDataObject&gt; data = vtkSmartPointer&lt;vtkDataObject&gt;::New();<br>
<br>        for (int b = 0; b &lt; 30; b++)   /// Assuming an array of 30 elements<br>        {<br>            hfile&gt;&gt;val;   /// My input is a file . <br>            array_s-&gt;InsertValue(b,val);<br>        }<br>        field-&gt;AddArray(array_s);<br>
        data-&gt;SetFieldData(field);<br>        plot-&gt;AddDataObjectInput(data);    <br>}<br><br><br>        plot-&gt;SetPlotColor(0,1,0,0);<br>        plot-&gt;SetPlotColor(1,0,1,0);<br><br> vtkSmartPointer&lt;vtkRenderer&gt; renderer = vtkSmartPointer&lt;vtkRenderer&gt;::New();<br>
  renderer-&gt;AddActor(plot);<br>  renderer-&gt;AddActor(rightplot);<br>  renderer-&gt;AddActor(leftplot);<br> <br>  vtkSmartPointer&lt;vtkRenderWindow&gt; renderWindow = vtkSmartPointer&lt;vtkRenderWindow&gt;::New();<br>
  renderWindow-&gt;AddRenderer( renderer );<br>  renderWindow-&gt;SetSize(1000,1000);<br> <br>  vtkSmartPointer&lt;vtkRenderWindowInteractor&gt; interactor =<br>      vtkSmartPointer&lt;vtkRenderWindowInteractor&gt;::New();<br>
  interactor-&gt;SetRenderWindow( renderWindow );<br> <br>  // Initialize the event loop and then start it<br>  interactor-&gt;Initialize();<br>  interactor-&gt;Start(); <br><br><br><br><div class="gmail_quote">On Sun, Mar 28, 2010 at 2:32 PM,  <span dir="ltr">&lt;<a href="mailto:edoardo.belletti@alice.it">edoardo.belletti@alice.it</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">






<div>


<p><font size="2">I don&#39;t have the latests CVS version of VTK but VTK 5.4.2 that I have download from <a href="http://www.vtk.org" target="_blank">www.vtk.org</a><br>
and so the code that you suggest me it doesn&#39;t  work because it don&#39;t found these files:<br>
vtkChartXY, vtkPlot.h.h, vtkContextView.h, vtkContextScene.h<br>
There is some way to simply have a XYPlot of two vectors with my VTK release?<br>
<br>
Thank you<br>
Edoardo<br>
<br>
-----Messaggio originale-----<br>
Da: <a href="mailto:daviddoria@gmail.com" target="_blank">daviddoria@gmail.com</a> per conto di David Doria<br>
Inviato: dom 28/03/2010 20.10<br>
A: <a href="mailto:edoardo.belletti@alice.it" target="_blank">edoardo.belletti@alice.it</a><br>
Cc: VTK_forum<br>
Oggetto: Re: [vtkusers] Plot XY<div><div></div><div class="h5"><br>
<br>
On Sun, Mar 28, 2010 at 2:03 PM, &lt;<a href="mailto:edoardo.belletti@alice.it" target="_blank">edoardo.belletti@alice.it</a>&gt; wrote:<br>
<br>
&gt;   Hello,<br>
&gt;<br>
&gt; I am new to VTK so please sorry if this problem is obvious.<br>
&gt;<br>
&gt; I am trying to use the XYPlotActor object to create a simply plot of one<br>
&gt; variable against another.<br>
&gt;<br>
&gt; I have found a piece of code in a past discussion and I have tried to run<br>
&gt; it but the problem is that it doesn&#39;t found the<br>
&gt; vtkFloatScalars.h file<br>
&gt; is there anything in particular that I should add in the CMakeLists.txt to<br>
&gt; include this library?<br>
&gt; the code is this:<br>
&gt;<br>
&gt; int main()<br>
&gt; {<br>
&gt;         int dataSize = 4;<br>
&gt;         float x[4] = { 0, 1.5, 6.2, 10.2 };<br>
&gt;         float y[4] = {8, 9.3, 10.9, 27};<br>
&gt;         vtkRectilinearGrid *curve1 = vtkRectilinearGrid::New();<br>
&gt;         curve1-&gt;SetDimensions(dataSize,1,1);<br>
&gt;         vtkFloatScalars *dataValues = vtkFloatScalars::New();<br>
&gt;         vtkFloatScalars *xCoords = vtkFloatScalars::New();<br>
&gt;<br>
&gt;         int w;<br>
&gt;         for(w=0; w&lt;dataSize; w++)<br>
&gt;         {<br>
&gt;                 dataValues-&gt;InsertScalar(w, y[w]);<br>
&gt;                 xCoords-&gt;InsertScalar(w, x[w]);<br>
&gt;         }<br>
&gt;<br>
&gt;         curve1-&gt;SetXCoordinates(xCoords);<br>
&gt;         curve1-&gt;GetPointData()-&gt;SetScalars(dataValues);<br>
&gt;<br>
&gt;         vtkXYPlotActor *theXYPlot = vtkXYPlotActor::New();<br>
&gt;         theXYPlot-&gt;SetXValuesToArcLength();<br>
&gt;         theXYPlot-&gt;AddInput(curve1);<br>
&gt;         return 0;<br>
&gt; }<br>
&gt;<br>
&gt; Thank you very much for the interest<br>
&gt; Edoardo<br>
&gt;<br>
&gt;<br>
&gt; There is no file in the current CVS called vtkFloatScalars.h, so I&#39;m<br>
assuming that is very old code.<br>
<br>
Marcus Hanwell has been working hard on new charting functionality - there<br>
is a simple example here:<br>
<a href="http://www.vtk.org/Wiki/VTK_Examples_Chart_XY" target="_blank">http://www.vtk.org/Wiki/VTK_Examples_Chart_XY</a><br>
<br>
You must have the latests CVS version of VTK built to use this new feature.<br>
&lt;<a href="http://www.vtk.org/Wiki/VTK_Examples_Chart_XY" target="_blank">http://www.vtk.org/Wiki/VTK_Examples_Chart_XY</a>&gt;<br></div></div>
Thanks,<br>
<br>
David<br>
<br>
</font>
</p>

</div>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br>