[Paraview] Python View Matplotlib

Jean-Michel Lucas jm.lucas at gantha.com
Thu Jan 7 11:39:33 EST 2016


Dear all,

I am trying to plot the result of a PlotOverLine filter using matplotlib in
the Pyton View. Following the documentation, this is where I got so far with
my Python View script:

 

def setup_data(view):

  for i in xrange(view.GetNumberOfVisibleDataObjects()):

    dataObject = view.GetVisibleDataObjectForSetup(i)

    view.DisableAllAttributeArrays()

    view.SetAttributeArrayStatus(i,vtkDataObject.POINT, "Vtot", 1)

    view.SetAttributeArrayStatus(i,vtkDataObject.POINT, "y", 1)

 

def render(view , width , height):

  from paraview import python_view

  figure = python_view.matplotlib_figure(width,height)

  for i in xrange(view.GetNumberOfVisibleDataObjects()):

    dataObject = view.GetVisibleDataObjectForRendering(i)

    test = dataObject.GetPointData().GetArray("Vtot")

    print test

 

  return python_view.figure_to_image(figure)

 

However,  the variable 'test' returns 'None', even though the array is
marked to be copied in the setup_data function (same goes for the "y"
array). I only have the PlotOverLine object visible in my pipeline, and it
is well detected in the setup_data function as dataObject.

Could someone help me understand what I am missing here?

 

Thanks in advance,

Jean-Michel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20160107/4d8a4bb5/attachment.html>


More information about the ParaView mailing list