[Paraview] Python View + Matplotlib
Jayaprakash, Arvind
ajayaprakash at hotwater.com
Wed Apr 26 12:18:53 EDT 2017
Dear All,
I am interested in using the matplotlib library to plot the data filtered through "PlotOverLine" filter. I believe this is of type vtkMultiBlockDataSet with 1 child (vtkPolyData)
I am having issues with SetAttributeArrayStatus(...) for an array in vtkMultiBlockDataSet.
Here is the script, I used:
def setup_data(view):
from paraview.numpy_support import vtk_to_numpy
for i in xrange(view.GetNumberOfVisibleDataObjects()):
dataObject = view.GetVisibleDataObjectForSetup(i).GetBlock(0) #Accessing the point data
pressure = dataObject.GetPointData().GetArray("p")
print vtk_to_numpy(pressure) # prints the pressure array
view.DisableAllAttributeArrays()
view.SetAttributeArrayStatus(i, vtkDataObject.POINT, "p", 1) # code breaks here! Could not pass the vtkDataObject.POINT array
def render(view, width, height):
from paraview.numpy_support import vtk_to_numpy
from paraview import python_view
figure = python_view.matplotlib_figure(width, height)
for i in xrange(view.GetNumberOfVisibleDataObjects()):
dataObject = view.GetVisibleDataObjectForRendering(i) .GetBlock(0)
pressure = dataObject.GetPointData().GetArray("p")
print vtk_to_numpy(pressure)
Any help is much appreciated.
Thanks,
Jay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20170426/35b1e31c/attachment.html>
More information about the ParaView
mailing list