[Paraview] Changing Chart Series Visibilities from Python

Greg Schussman schussman at slac.stanford.edu
Wed Oct 5 20:19:41 EDT 2011


Hi.

I have a ParaView macro which sets up a CSVReader, and a PlotData of 
that.  The variable names and legend names and series colors are all 
filled in automatically by ParaView.

What I would like to do is, from the python macro, iterate through all 
series in a chart and make specific ones visible or invisible.  
Recording a python trace of this gives:

try: paraview.simple

except: from paraview.simple import *

paraview.simple._DisableFirstRenderCameraReset()

PlotData1 = GetActiveSource()

my_representation0 = GetDisplayProperties(PlotData1)

my_representation0.SeriesColor = ['A(0,0)', '0', '1', '0']

my_representation0.SeriesVisibility = ['A(0,0)', '0']

Render()


When I go the python shell after doing this, and  I do this:

   p = FindSource("PlotData1")
   d = GetDisplayProperties(p)
   print d.SeriesVisibility

it gives me

   ['A(0,0)', '0']

but doesn't say anything about the other series ('A(0,1)' ... 'A(5,5)).

How do I get at the names of the other series?

If I had them, how would I use them?  Like the following?

Thanks.

Greg

new_visibility = []
For i in xrange(len(series_names)):
   new_visibility.append(series_names[i])
   if series_names[i] == 'A(1,3)':  # for example
      new_visibility.append('1')
   else:
      new_visibility.append('0')

d.SeriesVisibility = new_visibility

Render()

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20111005/c264f7b9/attachment.htm>


More information about the ParaView mailing list