[vtkusers] How to setup Parallel Coordinates?

Henry henryusp at gmail.com
Sat Oct 16 13:49:55 EDT 2010


Eric, It works! =DDD
Thank you! :-D

"I have other examples which include setting column/axis visibility and
getting the indices of selections that I can put up on the Wiki sometime."
I would be very happy with this. =]

I was trying to set visibilty and it doesn't work.
Example:

chart = vtk.vtkChartParallelCoordinates()
chart.SetColumnVisibilityAll(False)

Python says:
chart.SetColumnVisibilityAll(False)
AttributeError: SetColumnVisibilityAll

I don't know if I am the problem or if the vtk+python is. Because all I try
to do doesn't work. :s

Thank you
Henry


P.S. I'm trying to write in English, so sorry if I wrote wrong things. :)


On Sat, Oct 16, 2010 at 10:06, Eric E. Monson <emonson at cs.duke.edu> wrote:

> Hey Henry,
>
> After playing with it for a few minutes I'm starting to suspect that
> although vtkParallelCoordinatesRepresentation is supposed to accept a
> vtkTable as input, maybe there are some problems with that. The example from
> the Wiki uses a vtkImageData as input and plots its attributes.
>
> What you might want to do is to switch to using the parallel coordinates
> chart from the newer VTK Charts. It doesn't have quite as many selection
> mode options, but it is very nice. Also, I know it's built to take a table
> as input for sure:
>
> # ======
> import vtk
>
> # Set up a 2D scene, add an XY chart to it
> view = vtk.vtkContextView()
> view.GetRenderer().SetBackground(1.0, 1.0, 1.0)
> view.GetRenderWindow().SetSize(600,300)
>
> chart = vtk.vtkChartParallelCoordinates()
> view.GetScene().AddItem(chart)
>
> reader = vtk.vtkDelimitedTextReader()
> reader.DetectNumericColumnsOn()
> reader.SetFieldDelimiterCharacters(" ")
> reader.SetHaveHeaders(True)
> reader.SetMaxRecords(100)
> reader.SetFileName("News.gbdiv")
> reader.Update()
>
> chart.GetPlot(0).SetInput(reader.GetOutput())
>
> view.ResetCamera()
> view.Render()
>
> # Start interaction event loop
> view.GetInteractor().Start()
> # ======
>
> I have other examples which include setting column/axis visibility and
> getting the indices of selections that I can put up on the Wiki sometime.
>
> Talk to you later,
> -Eric
>
> ------------------------------------------------------
> Eric E Monson
> Duke Visualization Technology Group
>
>
> On Oct 15, 2010, at 11:49 PM, Henry wrote:
>
> Hi! :-)
> I'm having a problem and it's:
>
> I'd like to plot parallel coordinates but I can't. The
> vtkParallelCoordinatesRepresentation can't get my data. It doesn't plot the
> rows.
>
> I'm trying to be guided by the example of the wiki:
> http://www.vtk.org/Wiki/VTK/Examples/Python/Infovis/ParallelCoordinatesView
> (The example works very well; my code doesn't)
>
> My code is:
> *(...)
>
> reader = vtkDelimitedTextReader()
> reader.DetectNumericColumnsOn()
> reader.SetFieldDelimiterCharacters(" ")
> reader.SetHaveHeaders(True)
> reader.SetMaxRecords(100)
> reader.SetFileName(".\DataSets\News.gbdiv")
> reader.Update()
> #table = reader.GetOutput()
>
> rep = vtk.vtkParallelCoordinatesRepresentation()
>
> # I don't know why this don't work
>
> rep.SetInputConnection(reader.GetOutputPort())
>
> #I have tried many ways to put my data in, but nothing works. another is:
> #rep.SetInput(table)*
>
> *rep.SetInputArrayToProcess(0,0,0,0,'all')
> rep.SetInputArrayToProcess(1,0,0,0,'music')
> rep.SetInputArrayToProcess(2,0,0,0,'entertainment')
> rep.SetInputArrayToProcess(3,0,0,0,'health')
> rep.SetInputArrayToProcess(4,0,0,0,'business')
> rep.SetInputArrayToProcess(5,0,0,0,'sport')
> rep.SetInputArrayToProcess(6,0,0,0,'science')
> rep.SetInputArrayToProcess(7,0,0,0,'environment')
> rep.SetInputArrayToProcess(8,0,0,0,'politics')*
>
> #Here is the same code in the example of the wiki
> rep.SetUseCurves(0)
> rep.SetLineOpacity(0.5)
> view.SetRepresentation(rep)
> view.SetInspectMode(1)
> view.SetBrushModeToLasso()
> view.SetBrushOperatorToReplace()
> def ToggleInspectors(obj,event):
>     if (view.GetInspectMode() == 0):
>         view.SetInspectMode(1)
>     else:
>         view.SetInspectMode(0)
> view.GetInteractor().AddObserver("UserEvent", ToggleInspectors)
> view.GetRenderWindow().SetSize(1000,600)
> view.ResetCamera()
> view.Render()
> view.GetInteractor().Start()
>
>
> The data read by the reader is(each column,All, Music, Enter..., is a
> coordinate):
> *All Music Entertainment Health Business Sport Science Environment
> Politics
> 2.02657807 0.86289549 0.31007752 1.10266160 0.92307692 0.27089783
> 0.98556846 0.45808520 0.11614402
> 1.67774086 0.23969319 2.17054264 0.83650190 0.19230769 0.00000000
> 0.70397747 0.04580852 0.27100271
> 1.16279070 0.14381592 0.10335917 0.41825095 0.73076923 0.34829721
> 0.35198874 0.22904260 0.61943477*
> *(...)*
>
>
> What should I do to plot my data? What am I forgetting to? The reader get
> my data and the GetOutput() return a table. I've tried get some values by
> index and i'v got the right ones. But I can't plot it. =\
>
> Thank you,
> :)
>
> --
> Henry
>
> Bacharelado em Ciências de Computação - 2007
> ICMC - USP - São Carlos
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20101016/3008cd04/attachment.htm>


More information about the vtkusers mailing list