OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
color_by_property.py

Color graphical entity by property using a gradient

See Also
Gradient Example
1 pdb_name='sdh.pdb'
2 if len(sys.argv)>1:
3  pdb_name=sys.argv[1]
4 ent=io.LoadEntity(pdb_name)
5 
6 vv=ent.Select('peptide=true and aname=CA,N,C,O')
7 gradient=gfx.Gradient()
8 gradient.SetColorAt(1.0, gfx.Color(1.0, 0.0, 0.0, 1.0))
9 gradient.SetColorAt(0.5, gfx.Color(0.0, 1.0, 0.0, 1.0))
10 gradient.SetColorAt(0.0, gfx.Color(0.0, 0.0, 1.0, 1.0))
11 
12 go=gfx.Entity(os.path.splitext(os.path.basename(pdb_name))[0], vv)
13 go.ColorBy('abfac', gradient)
14 scene.Add(go)
15 scene.center=go.center