ROOT
git-r3/HEAD
Reference Guide
Loading...
Searching...
No Matches
logN.cxx
Go to the documentation of this file.
1
/// \file
2
/// \ingroup tutorial_webcanv
3
/// \notebook -js
4
/// Logarithmic scales support in web canvas.
5
///
6
/// Shows support of log2, ln, log8 and log25 scales
7
/// Any integer base for logarithm can be specified as well
8
///
9
/// Functionality available only in web-based graphics
10
///
11
/// \macro_image (tcanvas_js)
12
/// \macro_code
13
///
14
/// \author Sergey Linev
15
16
void
logN()
17
{
18
auto
h1
=
new
TH1I
(
"hist"
,
"Random data"
, 100, -5, 5);
19
h1
->FillRandom(
"gaus"
, 10000);
20
21
auto
c1
=
new
TCanvas
(
"c1"
,
"Logarithmic scales"
, 1200, 800);
22
23
if
(!
gROOT
->IsBatch() && !
c1
->IsWeb())
24
::Warning
(
"logN.cxx"
,
"macro will not work without enabling web-based canvas"
);
25
26
c1
->Divide(2, 2);
27
28
c1
->GetPad(1)->SetLogy(2);
// configure log2
29
c1
->GetPad(1)->Add(
h1
,
""
);
// draw with default draw option
30
31
c1
->GetPad(2)->SetLogy(3);
// configure ln - 3 is special case
32
c1
->GetPad(2)->Add(
h1
,
"l"
);
// draw histogram as line
33
34
c1
->GetPad(3)->SetLogy(8);
// configure log8
35
c1
->GetPad(3)->Add(
h1
,
"c"
);
// draw histogram as curve
36
37
c1
->GetPad(4)->SetLogy(25);
// configure log25
38
c1
->GetPad(4)->Add(
h1
,
"E"
);
// draw histogram as errors
39
}
Warning
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Definition
TError.cxx:252
gROOT
#define gROOT
Definition
TROOT.h:417
TCanvas
The Canvas class.
Definition
TCanvas.h:23
TH1I
1-D histogram with an int per channel (see TH1 documentation)
Definition
TH1.h:796
c1
return c1
Definition
legend1.C:41
h1
TH1F * h1
Definition
legend1.C:5
tutorials
visualisation
webcanv
logN.cxx
ROOTgit-r3/HEAD - Reference Guide Generated on
(GVA Time) using Doxygen 1.16.1