[Paraview] Changing Chart Series Visibilities from Python

pat marion pat.marion at kitware.com
Thu Oct 6 10:33:27 EDT 2011


Hi Greg,

If you look at Plugins/pvblot/tplot.py you'll find some code that does
exactly this.  You may find some other useful chart code in there too.

For your example, you could do:

series_names = [name for name in d.GetProperty("SeriesNamesInfo")]


Pat

On Wed, Oct 5, 2011 at 8:19 PM, Greg Schussman
<schussman at slac.stanford.edu>wrote:

> **
> 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()
>
>
> _______________________________________________
> 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
>
> Follow this link to subscribe/unsubscribe:
> http://www.paraview.org/mailman/listinfo/paraview
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20111006/8b0a9a53/attachment.htm>


More information about the ParaView mailing list