With a lot of help from Utkarsh, I now know how to set custom color maps in
Python. Here is what I did, and the code, for coloring Sources/ Wavelet by the
blue to red rainbow. (And has been said, blue to red rainbow is a poor color
map for doing real work. It does create pretty pictures, however.)
ParaView 4.3.1, local server, Linux.
Sources/ wavelet/ apply. Change outline to surface. Paint by RTData.
Color editor. Preset - Blue to Red Rainbow. Export. Save this as an xml file
somewhere you can find it.
Edit this .xml file. There will be two ColorMaps (unless this has been fixed).
Delete the second group (from ColorMap to /ColorMap). Also, delete the two
lines with ColorMaps in them.
(Note - I will write up bugs for these two issues.)
Edit/ reset session.
Tools/ Start Trace. OK.
Sources/ Wavelet. Apply. Change outline to surface. Paint by RTData.
Tools/ Stop Trace.
Save the script.
Edit the script. Below the line where it says
wavelet1Display.SetScalarBarVisibility(renderView1, True), add the following:
lut = GetColorTransferFunction("RTData")
with open("/..../junkDir/blue-to-red-rainbow.xml", "r") as f:
data = f.read()
lut.ApplyColorMap(data)
Then, comment out the two lines that say:
# get color transfer function/color map for 'RTData'
rTDataLUT = GetColorTransferFunction('RTData')
# get opacity transfer function/opacity map for 'RTData'
rTDataPWF = GetOpacityTransferFunction('RTData')
Save your file, then in ParaView do the following:
Edit/ reset session.
Tools/ Python shell. Run script.
Alan
_______________________________________________
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
Search the list archives at: http://markmail.org/search/?q=ParaView
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview