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