ROOT
Version v6.32
master
v6.34
Reference Guide
▼
ROOT
ROOT Reference Documentation
Tutorials
▼
Functional Parts
►
Core ROOT classes
►
std Extension classes
►
Parallelized classes
►
The Geometry Package
►
Graphics
►
Event display with ROOT7
►
GUI
►
Web Widgets
►
Web Display
►
Histogram Library
►
Input/Output Library
►
Math
►
N-D parametric functions
►
VecOps
►
Monte Carlo
►
HTTP server
►
PROOF
►
TMVA
►
RooFit
►
Dataframe
►
ROOT7 classes
►
NTuple-related classes
►
Tree Library
►
TreePlayer Library
▼
Tutorials
▼
Histograms tutorials
candledecay.C
candlehisto.C
candleplot.C
candleplotoption.C
candleplotstack.C
candleplotwhiskers.C
candlescaled.C
ContourList.C
cumulative.C
draw2dopt.C
DynamicSlice.C
exec1.C
exec2.C
Fibonacci.C
fillhistosauto2p.C
fillrandom.C
fillrandom.py
FirstContour.C
greyscale.C
h1ReadAndDraw.C
h2_cut.C
h2proj.C
hbars.C
histpalettecolor.C
hksimple.C
hlabels1.C
hlabels2.C
hlHisto1.C
hlHisto2.C
hlHisto3.C
hlHisto4.C
hstack.C
hsum.C
hsumTimer.C
legendautoplaced.C
logscales.C
movepalette.C
multicolor.C
NormalizeHistogram.C
ratioplot1.C
ratioplot1.py
ratioplot2.C
ratioplot2.py
ratioplot3.C
ratioplot3.py
ratioplot4.C
ratioplot4.py
ratioplot5.C
ratioplot5.py
ratioplot6.C
ratioplot6.py
ratioplotOld.C
rebin.C
reverseaxis.C
sparsehist.C
statsEditing.C
testSmooth.C
th2polyBoxes.C
th2polyEurope.C
th2polyHoneycomb.C
th2polyUSA.C
thstack2palettecolor.C
thstackpalettecolor.C
tprofile2polyRealistic.C
tprofile2polyRealisticModuleError.C
transpad.C
twoscales.C
twoscales.py
xyplot.C
ZoomHistogram.C
►
Tree tutorials
►
Dataframe tutorials
►
ROOT 7 tutorials
►
FOAM tutorials
►
Containers tutorials
►
Event display tutorials
►
Event display ROOT7 tutorials
►
Geometry tutorials
►
Fast Fourier Transforms tutorials
►
Fit Tutorials
►
RooFit Tutorials
►
Graphs tutorials
►
Graphics tutorials
►
OpenGL tutorials
►
Tutorials specific to Mac/Cocoa
►
GUI tutorials
►
HistFactory Tutorials
►
HTTP tutorials
►
Image tutorials
►
IO tutorials
►
Math tutorials
►
Matrix tutorials
►
Monte Carlo tutorials
►
Multicore tutorials
►
Net tutorials
►
Physics tutorials
►
PyRoot tutorials
►
Pythia tutorials
►
Quadratic programming package.
►
R tutorials
►
RooStats Tutorials
►
Spectrum tutorials
►
TSPlot tutorials
►
SQL tutorials
►
TMVA tutorials
►
TUnfold tutorials
►
Unuran tutorials
►
VecOps tutorials
►
FITS files interface tutorials
►
XML tutorials
►
Proof tutorials
►
Webgui tutorials
►
Legacy tutorials
demos.C
demoshelp.C
hsimple.C
rootlogoff.C
rootlogon.C
►
R Interface for Statistical Computing
►
Namespaces
►
All Classes
►
Files
Release Notes
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
Loading...
Searching...
No Matches
candleplotstack.C File Reference
Tutorials
»
Histograms tutorials
Detailed Description
Example showing how a
THStack
with candle plot option.
void
candleplotstack
()
{
gStyle
->
SetTimeOffset
(0);
auto
rng
=
new
TRandom
();
auto
dateBegin
=
new
TDatime
(2010,1,1,0,0,0);
auto
dateEnd
=
new
TDatime
(2011,1,1,0,0,0);
int
bins = 1000;
auto
h1
=
new
TH2I
(
"h1"
,
"Machine A"
,6,
dateBegin
->Convert(),
dateEnd
->Convert(),bins,0,1000);
auto
h2 =
new
TH2I
(
"h2"
,
"Machine B"
,6,
dateBegin
->Convert(),
dateEnd
->Convert(),bins,0,1000);
auto
hsum
=
new
TH2I
(
"h4"
,
"Sum"
,6,
dateBegin
->Convert(),
dateEnd
->Convert(),bins,0,1000);
float
Rand
;
for
(
int
i =
dateBegin
->Convert(); i <
dateEnd
->Convert(); i+=86400*30) {
for
(
int
j
= 0;
j
< 1000;
j
++) {
Rand
=
rng
->Gaus(500+sin(i/10000000.)*100,50);
h1
->
Fill
(i,
Rand
);
hsum
->Fill(i,
Rand
);
Rand
=
rng
->Gaus(500+sin(i/12000000.)*100,50); h2->Fill(i,
Rand
);
hsum
->Fill(i,
Rand
);
}
}
h2
->SetLineColor(
kRed
);
hsum
->SetFillColor(
kGreen
);
TCanvas
*
c1
=
new
TCanvas
();
auto
hs
=
new
THStack
(
"hs"
,
"Machine A+B"
);
hs
->Add(
h1
);
hs
->Add(h2,
"candle2"
);
hs
->Add(
hsum
,
"violin1"
);
hs
->Draw(
"candle3"
);
hs
->GetXaxis()->SetNdivisions(410);
gPad
->SetGrid(1,0);
hs
->GetXaxis()->SetTimeDisplay(1);
hs
->GetXaxis()->SetTimeFormat(
"%d/%m/%y"
);
hs
->GetXaxis()->SetNdivisions(-6);
hs
->GetXaxis()->SetTitle(
"Date [day/month/year]"
);
c1
->Modified();
gPad
->BuildLegend(0.75,0.75,0.95,0.95,
""
);
}
kRed
@ kRed
Definition
Rtypes.h:66
kGreen
@ kGreen
Definition
Rtypes.h:66
TRangeDynCast
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Definition
TCollection.h:358
gStyle
R__EXTERN TStyle * gStyle
Definition
TStyle.h:433
gPad
#define gPad
Definition
TVirtualPad.h:305
ROOT::Detail::TRangeCast
Definition
TCollection.h:311
TCanvas
The Canvas class.
Definition
TCanvas.h:23
TDatime
This class stores the date and time with a precision of one second in an unsigned 32 bit word (950130...
Definition
TDatime.h:37
TH1::Fill
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
Definition
TH1.cxx:3344
TH2I
2-D histogram with an int per channel (see TH1 documentation)
Definition
TH2.h:225
THStack
The Histogram stack class.
Definition
THStack.h:40
TRandom
This is the base class for the ROOT Random number generators.
Definition
TRandom.h:27
TStyle::SetTimeOffset
void SetTimeOffset(Double_t toffset)
Change the time offset for time plotting.
Definition
TStyle.cxx:1909
c1
return c1
Definition
legend1.C:41
h1
TH1F * h1
Definition
legend1.C:5
TMVA_SOFIE_GNN_Parser.h2
h2
Definition
TMVA_SOFIE_GNN_Parser.py:188
hsum
Definition
hsum.py:1
Authors
Georg Troska, Olivier Couet
Definition in file
candleplotstack.C
.
tutorials
hist
candleplotstack.C
ROOT v6-32 - Reference Guide Generated on Wed Mar 26 2025 04:43:32 (GVA Time) using Doxygen 1.10.0