Hi Greg,<br><br>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.<br><br>For your example, you could do:<br><br>series_names = [name for name in d.GetProperty("SeriesNamesInfo")]<br>
<br><br>Pat<br><br><div class="gmail_quote">On Wed, Oct 5, 2011 at 8:19 PM, Greg Schussman <span dir="ltr"><<a href="mailto:schussman@slac.stanford.edu">schussman@slac.stanford.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<u></u>
<div bgcolor="#ffffff" text="#000000">
<font size="+1"><font face="Droid Serif">Hi.<br>
<br>
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.<br>
<br>
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:<br>
<br>
</font></font>
<p style="margin:0px;text-indent:0px"> try: paraview.simple</p>
<p style="margin:0px;text-indent:0px"> except: from
paraview.simple import *</p>
<p style="margin:0px;text-indent:0px">
paraview.simple._DisableFirstRenderCameraReset()</p>
<p style="margin:0px;text-indent:0px"> PlotData1 =
GetActiveSource()</p>
<p style="margin:0px;text-indent:0px"> my_representation0 =
GetDisplayProperties(PlotData1)</p>
<p style="margin:0px;text-indent:0px">
my_representation0.SeriesColor = ['A(0,0)', '0', '1', '0']</p>
<p style="margin:0px;text-indent:0px">
my_representation0.SeriesVisibility = ['A(0,0)', '0']</p>
<p style="margin:0px;text-indent:0px"> Render()</p>
<br>
<font size="+1"><font face="Droid Serif">When I go the python shell
after doing this, and I do this:<br>
<br>
p = FindSource("PlotData1")<br>
d = GetDisplayProperties(p)<br>
print d.SeriesVisibility<br>
<br>
it gives me<br>
<br>
['A(0,0)', '0']<br>
<br>
but doesn't say anything about the other series ('A(0,1)' ...
'A(5,5)).<br>
<br>
How do I get at the names of the other series? <br>
<br>
If I had them, how would I use them? Like the following?<br>
<br>
Thanks.<br>
<br>
Greg<br>
<br>
new_visibility = []<br>
For i in xrange(len(series_names)):<br>
new_visibility.append(series_names[i])<br>
if series_names[i] == 'A(1,3)': # for example<br>
new_visibility.append('1')<br>
else:<br>
new_visibility.append('0')<br>
<br>
d.SeriesVisibility = new_visibility<br>
<br>
Render()<br>
<br>
</font></font>
</div>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
<br></blockquote></div><br>