Logo ROOT   master
Reference Guide
surfaces.py
Go to the documentation of this file.
1 ## \file
2 ## \ingroup tutorial_pyroot
3 ## \notebook
4 ## Surfaces example
5 ##
6 ## \macro_image
7 ## \macro_code
8 ##
9 ## \author Wim Lavrijsen
10 
11 from ROOT import TCanvas, TPaveText, TPad, TF2
12 from ROOT import gROOT, gStyle
13 
14 
15 
16 c1 = TCanvas( 'c1', 'Surfaces Drawing Options', 200, 10, 700, 900 )
17 c1.SetFillColor( 42 )
18 gStyle.SetFrameFillColor( 42 )
19 title = TPaveText( .2, 0.96, .8, .995 )
20 title.SetFillColor( 33 )
21 title.AddText( 'Examples of Surface options' )
22 title.Draw()
23 
24 pad1 = TPad( 'pad1', 'Gouraud shading', 0.03, 0.50, 0.98, 0.95, 21 )
25 pad2 = TPad( 'pad2', 'Color mesh', 0.03, 0.02, 0.98, 0.48, 21 )
26 pad1.Draw()
27 pad2.Draw()
28 
29 # We generate a 2-D function
30 f2 = TF2( 'f2', 'x**2 + y**2 - x**3 -8*x*y**4', -1, 1.2, -1.5, 1.5 )
31 f2.SetContour( 48 )
32 f2.SetFillColor( 45 )
33 
34 # Draw this function in pad1 with Gouraud shading option
35 pad1.cd()
36 pad1.SetPhi( -80 )
37 pad1.SetLogz()
38 f2.Draw( 'surf4' )
39 
40 # Draw this function in pad2 with color mesh option
41 pad2.cd()
42 pad2.SetTheta( 25 )
43 pad2.SetPhi( -110 )
44 pad2.SetLogz()
45 f2.Draw( 'surf1' )
46 
47 c1.Update()
The most important graphics class in the ROOT system.
Definition: TPad.h:29
A 2-Dim function with parameters.
Definition: TF2.h:29
The Canvas class.
Definition: TCanvas.h:27
A Pave (see TPave) with text, lines or/and boxes inside.
Definition: TPaveText.h:21