<div dir="ltr"><div><div><div>Hi Richard,<br><br></div>Since you didn't specify the version you are using I'm using 5.4-RC3 for this answer.  I loaded a dataset and ran the Python Trace (Tools -> Start Trace) to find out what it is doing.  Here is the python script that was generated from changing what the dataset was colored by.<br><br>

<p style="margin:0px;text-indent:0px"><br></p>
<pre style="margin:0px;text-indent:0px"><span style="font-family:"monospace";font-style:italic;color:rgb(64,128,128)"># get active source.</span></pre>
<pre style="margin:0px;text-indent:0px"><span style="font-family:"monospace"">canex2 </span><span style="font-family:"monospace";color:rgb(102,102,102)">=</span><span style="font-family:"monospace""> GetActiveSource()</span></pre>
<pre style="margin:0px;text-indent:0px;font-family:"monospace""><br></pre>
<pre style="margin:0px;text-indent:0px"><span style="font-family:"monospace";font-style:italic;color:rgb(64,128,128)"># get active view</span></pre>
<pre style="margin:0px;text-indent:0px"><span style="font-family:"monospace"">renderView1 </span><span style="font-family:"monospace";color:rgb(102,102,102)">=</span><span style="font-family:"monospace""> GetActiveViewOrCreate(</span><span style="font-family:"monospace";color:rgb(186,33,33)">'RenderView'</span><span style="font-family:"monospace"">)</span></pre>
<pre style="margin:0px;text-indent:0px"><span style="font-family:"monospace";font-style:italic;color:rgb(64,128,128)"># uncomment following to set a specific view size</span></pre>
<pre style="margin:0px;text-indent:0px"><span style="font-family:"monospace";font-style:italic;color:rgb(64,128,128)"># renderView1.ViewSize = [1330, 670]</span></pre>
<pre style="margin:0px;text-indent:0px;font-family:"monospace";font-style:italic;color:rgb(64,128,128)"><br></pre>
<pre style="margin:0px;text-indent:0px"><span style="font-family:"monospace";font-style:italic;color:rgb(64,128,128)"># get display properties</span></pre>
<pre style="margin:0px;text-indent:0px"><span style="font-family:"monospace"">canex2Display </span><span style="font-family:"monospace";color:rgb(102,102,102)">=</span><span style="font-family:"monospace""> GetDisplayProperties(canex2, view</span><span style="font-family:"monospace";color:rgb(102,102,102)">=</span><span style="font-family:"monospace"">renderView1)</span></pre>
<pre style="margin:0px;text-indent:0px;font-family:"monospace""><br></pre>
<pre style="margin:0px;text-indent:0px"><span style="font-family:"monospace";font-style:italic;color:rgb(64,128,128)"># set scalar coloring</span></pre>
<pre style="margin:0px;text-indent:0px"><span style="font-family:"monospace"">ColorBy(canex2Display, (</span><span style="font-family:"monospace";color:rgb(186,33,33)">'POINTS'</span><span style="font-family:"monospace"">, </span><span style="font-family:"monospace";color:rgb(186,33,33)">'VEL'</span><span style="font-family:"monospace"">, </span><span style="font-family:"monospace";color:rgb(186,33,33)">'Magnitude'</span><span style="font-family:"monospace"">))</span></pre>
<pre style="margin:0px;text-indent:0px;font-family:"monospace""><br></pre>
<pre style="margin:0px;text-indent:0px"><span style="font-family:"monospace";font-style:italic;color:rgb(64,128,128)"># get color transfer function/color map for 'vtkBlockColors'</span></pre>
<pre style="margin:0px;text-indent:0px"><span style="font-family:"monospace"">vtkBlockColorsLUT </span><span style="font-family:"monospace";color:rgb(102,102,102)">=</span><span style="font-family:"monospace""> GetColorTransferFunction(</span><span style="font-family:"monospace";color:rgb(186,33,33)">'vtkBlockColors'</span><span style="font-family:"monospace"">)</span></pre>
<pre style="margin:0px;text-indent:0px;font-family:"monospace""><br></pre>
<pre style="margin:0px;text-indent:0px"><span style="font-family:"monospace";font-style:italic;color:rgb(64,128,128)"># Hide the scalar bar for this color map if no visible data is colored by it.</span></pre>
<pre style="margin:0px;text-indent:0px"><span style="font-family:"monospace"">HideScalarBarIfNotNeeded(vtkBlockColorsLUT, renderView1)</span></pre>
<pre style="margin:0px;text-indent:0px;font-family:"monospace""><br></pre>
<pre style="margin:0px;text-indent:0px"><span style="font-family:"monospace";font-style:italic;color:rgb(64,128,128)"># rescale color and/or opacity maps used to include current data range</span></pre>
<pre style="margin:0px;text-indent:0px"><span style="font-family:"monospace"">canex2Display</span><span style="font-family:"monospace";color:rgb(102,102,102)">.</span><span style="font-family:"monospace"">RescaleTransferFunctionToDataRange(</span><span style="font-family:"monospace";color:rgb(0,128,0)">True</span><span style="font-family:"monospace"">, </span><span style="font-family:"monospace";color:rgb(0,128,0)">False</span><span style="font-family:"monospace"">)</span></pre>
<pre style="margin:0px;text-indent:0px;font-family:"monospace""><br></pre>
<pre style="margin:0px;text-indent:0px"><span style="font-family:"monospace";font-style:italic;color:rgb(64,128,128)"># show color bar/color legend</span></pre>
<pre style="margin:0px;text-indent:0px"><span style="font-family:"monospace"">canex2Display</span><span style="font-family:"monospace";color:rgb(102,102,102)">.</span><span style="font-family:"monospace"">SetScalarBarVisibility(renderView1, </span><span style="font-family:"monospace";color:rgb(0,128,0)">True</span><span style="font-family:"monospace"">)</span></pre>
<pre style="margin:0px;text-indent:0px;font-family:"monospace""><br></pre>
<pre style="margin:0px;text-indent:0px"><span style="font-family:"monospace";font-style:italic;color:rgb(64,128,128)"># get color transfer function/color map for 'VEL'</span></pre>
<pre style="margin:0px;text-indent:0px"><span style="font-family:"monospace"">vELLUT </span><span style="font-family:"monospace";color:rgb(102,102,102)">=</span><span style="font-family:"monospace""> GetColorTransferFunction(</span><span style="font-family:"monospace";color:rgb(186,33,33)">'VEL'</span><span style="font-family:"monospace"">)</span></pre>
<pre style="margin:0px;text-indent:0px;font-family:"monospace""><br></pre>It is hiding the scalar bar for vtkBlockColors since that is what the data used to be colored by.  I think your problem will be solved by using the GetDisplayProperties and ColorBy functions rather than setting ColorArrayName.<br></div><div><br></div>HTH,<br></div>Shawn<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, May 27, 2017 at 1:35 PM, Richard Kalhoefer <span dir="ltr"><<a href="mailto:kalhoefer@physik.uni-kiel.de" target="_blank">kalhoefer@physik.uni-kiel.de</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 style="font-size:10pt;font-family:Verdana,Geneva,sans-serif">
<p>Hey,<br><br>I have a python script that opens a Legacy VTK file that contains two scalar arrays of the same length (real and imaginary part of a wave function) and then adjusts the camera settings, representation and color. My transfer functions seem to be ignored and I just get full opacity and black color. Running the script inside the GUI's python shell gives the same result, but when I then change the array under Display->Coloring to the other one and back again. everything looks as expected. So my question is: What is this GUI element doing beyond "GetRepresentation(reader, view).ColorArrayName = ['POINTS', arrayname]" and how can I do the same within the python script?<br><br>Kind regards<br>Richard Kalhöfer</p>
</div>
<br>______________________________<wbr>_________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" rel="noreferrer" target="_blank">http://paraview.org/Wiki/<wbr>ParaView</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=ParaView" rel="noreferrer" target="_blank">http://markmail.org/search/?q=<wbr>ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/paraview" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/paraview</a><br>
<br></blockquote></div><br></div>