Creating a color table
Sometimes, it is useful to create your own color table within VisIt using Python scripting. It is not as hard as you might think either.
def MakeRGBColorTable(name, ct):
ccpl = ColorControlPointList()
for pt in ct:
p = ColorControlPoint()
p.colors = (pt[0] * 255, pt[1] * 255, pt[2] * 255, 255)
p.position = pt[3]
ccpl.AddControlPoints(p)
AddColorTable(name, ccpl)
# Make a plot
OpenDatabase("/usr/gapps/visit/data/globe.silo")
AddPlot("Pseudocolor", "speed")
DrawPlots()
# Now make a new color table. each control point is: (r,g,b,t)
ct = ((1,0,0,0.), (1,0.8,0.,0.166), (1,1,0,0.333), (0,1,0,0.5), (0,1,1,0.666), (0,0,1,0.8333), (0.8,0.1,1,1))
MakeRGBColorTable("myrainbow", ct)
# Make the plot use the new color table
pc = PseudocolorAttributes(1)
pc.colorTableName = "myrainbow"
SetPlotOptions(pc)
If you want to further customize the color table by setting its discrete flags or other such flags, you can set those properties on the ColorControlPointList that we use to create the color table. To determine the methods that are available for setting those properties, you can always call: dir(ColorControlPointList()).