[Paraview] Python View + Matplotlib

Cory Quammen cory.quammen at kitware.com
Thu Apr 27 10:53:16 EDT 2017


Arvind,

Please explain how the code breaks at the line you cited. What error
message are you seeing?

Thanks,
Cory

On Wed, Apr 26, 2017 at 12:18 PM, Jayaprakash, Arvind
<ajayaprakash at hotwater.com> wrote:
> 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
>
>
> _______________________________________________
> 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 ParaView Wiki at:
> http://paraview.org/Wiki/ParaView
>
> Search the list archives at: http://markmail.org/search/?q=ParaView
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/paraview
>



-- 
Cory Quammen
Staff R&D Engineer
Kitware, Inc.


More information about the ParaView mailing list