ROOT
master
Reference Guide
Loading...
Searching...
No Matches
surfaces.C File Reference
Tutorials
»
Visualisation tutorials
»
Graphs tutorials
Detailed Description
Draw 2-Dim functions.
void
surfaces
()
{
TCanvas
*
c1
=
new
TCanvas
(
"c1"
,
"Surfaces Drawing Options"
, 200, 10, 700, 900);
TPaveText
*title =
new
TPaveText
(.2, 0.96, .8, .995);
title->
AddText
(
"Examples of Surface options"
);
title->
Draw
();
TPad
*pad1 =
new
TPad
(
"pad1"
,
"Gouraud shading"
, 0.03, 0.50, 0.98, 0.95);
TPad
*pad2 =
new
TPad
(
"pad2"
,
"Color mesh"
, 0.03, 0.02, 0.98, 0.48);
pad1->
Draw
();
pad2->
Draw
();
//
// We generate a 2-D function
TF2
*f2 =
new
TF2
(
"f2"
,
"x**2 + y**2 - x**3 -8*x*y**4"
, -1, 1.2, -1.5, 1.5);
f2->
SetContour
(48);
f2->
SetFillColor
(45);
// Draw this function in pad1 with Gouraud shading option
pad1->
cd
();
pad1->
SetPhi
(-80);
pad1->
SetLogz
();
f2->
Draw
(
"surf4"
);
// Draw this function in pad2 with color mesh option
pad2->
cd
();
pad2->
SetTheta
(25);
pad2->
SetPhi
(-110);
pad2->
SetLogz
();
f2->
SetLineWidth
(1);
f2->
SetLineColor
(5);
f2->
Draw
(
"surf1"
);
// add axis titles. The titles are set on the intermediate
// histogram used for visualisation. We must force this histogram
// to be created, then force the redrawing of the two pads
pad2->
Update
();
f2->
GetHistogram
()->
GetXaxis
()->
SetTitle
(
"x title"
);
f2->
GetHistogram
()->
GetYaxis
()->
SetTitle
(
"y title"
);
f2->
GetHistogram
()->
GetXaxis
()->
SetTitleOffset
(1.4);
f2->
GetHistogram
()->
GetYaxis
()->
SetTitleOffset
(1.4);
pad1->
Modified
();
pad2->
Modified
();
}
TAttAxis::SetTitleOffset
virtual void SetTitleOffset(Float_t offset=1)
Set distance between the axis and the axis title.
Definition
TAttAxis.cxx:298
TAttFill::SetFillColor
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition
TAttFill.h:37
TAttLine::SetLineWidth
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
Definition
TAttLine.h:43
TAttLine::SetLineColor
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition
TAttLine.h:40
TCanvas
The Canvas class.
Definition
TCanvas.h:23
TF1::GetHistogram
virtual TH1 * GetHistogram() const
Return a pointer to the histogram used to visualise the function Note that this histogram is managed ...
Definition
TF1.cxx:1584
TF2
A 2-Dim function with parameters.
Definition
TF2.h:29
TF2::SetContour
virtual void SetContour(Int_t nlevels=20, const Double_t *levels=nullptr)
Set the number and values of contour levels.
Definition
TF2.cxx:892
TF2::Draw
void Draw(Option_t *option="") override
Draw this function with its current attributes.
Definition
TF2.cxx:259
TH1::GetXaxis
TAxis * GetXaxis()
Definition
TH1.h:325
TH1::GetYaxis
TAxis * GetYaxis()
Definition
TH1.h:326
TNamed::SetTitle
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition
TNamed.cxx:164
TPad
The most important graphics class in the ROOT system.
Definition
TPad.h:28
TPad::SetLogz
void SetLogz(Int_t value=1) override
Set Lin/Log scale for Z.
Definition
TPad.cxx:6111
TPad::Update
void Update() override
Update pad.
Definition
TPad.cxx:2935
TPad::SetPhi
void SetPhi(Double_t phi=30) override
Definition
TPad.h:360
TPad::Modified
void Modified(Bool_t flag=true) override
Mark pad modified Will be repainted when TCanvas::Update() will be called next time.
Definition
TPad.cxx:7388
TPad::cd
TVirtualPad * cd(Int_t subpadnumber=0) override
Set Current pad.
Definition
TPad.cxx:693
TPad::Draw
void Draw(Option_t *option="") override
Draw Pad in Current pad (re-parent pad if necessary).
Definition
TPad.cxx:1364
TPad::SetTheta
void SetTheta(Double_t theta=30) override
Definition
TPad.h:359
TPaveText
A Pave (see TPave) with text, lines or/and boxes inside.
Definition
TPaveText.h:21
TPaveText::AddText
virtual TText * AddText(Double_t x1, Double_t y1, const char *label)
Add a new Text line to this pavetext at given coordinates.
Definition
TPaveText.cxx:190
TPaveText::Draw
void Draw(Option_t *option="") override
Draw this pavetext with its current attributes.
Definition
TPaveText.cxx:241
c1
return c1
Definition
legend1.C:41
surfaces
Definition
surfaces.py:1
Author
Rene Brun
Definition in file
surfaces.C
.
tutorials
visualisation
graphs
surfaces.C
ROOT master - Reference Guide Generated on Wed Dec 18 2024 10:11:03 (GVA Time) using Doxygen 1.9.8