[vtkusers] vtkXYPlotActor Not Plotting All Points
LOUIS-JORDAN DEERING (RIT Student)
ljd3100 at rit.edu
Tue Mar 22 09:41:24 EDT 2011
Hi Fellow VTK Users,
I am trying to create a simple 2-Dimensional Graph, but I can't seem to get all of the points to plot onto the graph. Only the first three points are plotting. I don't know if it's an issue with the vtk file I'm reading, or the code itself. I've included both below. Secondly, how do you determine dimensions in a vtk file? I haven't found a definition anywhere for it, not even in the VTK User's Guide. Thank you,
Luzjadi
----------------------------------------------------------------------
Code
----------------------------------------------------------------------
package require vtk
package require vtkinteraction
vtkStructuredGridReader reader
reader SetFileName "points.vtk"
reader Update
vtkDataSetToDataObjectFilter dataObject
dataObject SetInputConnection [reader GetOutputPort]
dataObject Update
vtkXYPlotActor plot
plot AddDataObjectInput [dataObject GetOutput]
# plot SetXRange 0.0 32.0
# plot SetYRange 0.0 9.0
plot SetXValuesToArcLength
plot SetTitle "Graph"
plot SetXTitle "X"
plot SetYTitle "Y"
plot SetXValuesToValue
plot SetWidth 1.0
plot SetHeight 1.0
plot SetPosition 0.0 0.0
plot LegendOn
plot PickableOff
plot PlotLinesOff
plot PlotPointsOn
plot SetDataObjectXComponent 0 0
plot SetDataObjectYComponent 0 1
plot SetPlotColor 0 1.0 0.0 0.0
plot SetPlotLabel 0 "The Label"
[plot GetProperty] SetColor 0.0 0.0 0.0
vtkRenderer renderer
renderer SetBackground 1.0 1.0 1.0
renderer AddActor2D plot
vtkRenderWindow renderWindow
renderWindow SetSize 550 450
renderWindow AddRenderer renderer
vtkRenderWindowInteractor iren
iren SetRenderWindow renderWindow
vtkXYPlotWidget grapher
grapher SetXYPlotActor plot
grapher SetInteractor iren
grapher SetEnabled 1
renderWindow Render
iren Start
-----------------------------------------------------------------------
vtk file
-----------------------------------------------------------------------
# vtk DataFile Version 3.0
MERIDIONAL DATA
ASCII
DATASET STRUCTURED_GRID
DIMENSIONS 10 1 1
POINTS 10 double
0 0 0
1 2 0
2 4 0
3 8 0
4 16 0
5 32 0
6 16 0
7 8 0
8 4 0
9 2 0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110322/cf5fbe04/attachment.htm>
More information about the vtkusers
mailing list