ROOT
Version v6.34
master
v6.32
v6.30
v6.28
v6.26
v6.24
v6.22
v6.20
v6.18
v6.16
v6.14
v6.12
v6.10
v6.08
v6.06
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
hstackpads.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
thstackcolorscheme.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
►
TWebCanvas 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
hlabels2.C File Reference
Tutorials
»
Histograms tutorials
Detailed Description
2-D histograms with alphanumeric labels.
TCanvas
*
hlabels2
()
{
const
Int_t
nx
= 12;
const
Int_t
ny
= 20;
const
char
*
month
[
nx
] = {
"January"
,
"February"
,
"March"
,
"April"
,
"May"
,
"June"
,
"July"
,
"August"
,
"September"
,
"October"
,
"November"
,
"December"
};
const
char
*
people
[
ny
] = {
"Jean"
,
"Pierre"
,
"Marie"
,
"Odile"
,
"Sebastien"
,
"Fons"
,
"Rene"
,
"Nicolas"
,
"Xavier"
,
"Greg"
,
"Bjarne"
,
"Anton"
,
"Otto"
,
"Eddy"
,
"Peter"
,
"Pasha"
,
"Philippe"
,
"Suzanne"
,
"Jeff"
,
"Valery"
};
TCanvas
*
c1
=
new
TCanvas
(
"c1"
,
"demo bin labels"
,10,10,600,600);
c1
->SetGrid();
c1
->SetLeftMargin(0.15);
c1
->SetBottomMargin(0.15);
TH2F
*
h
=
new
TH2F
(
"h"
,
"test"
,3,0,3,2,0,2);
h
->SetCanExtend(
TH1::kAllAxes
);
h
->SetStats(0);
gRandom
->
SetSeed
();
for
(
Int_t
i=0;i<15000;i++) {
Int_t
rx =
gRandom
->
Rndm
()*
nx
;
Int_t
ry =
gRandom
->
Rndm
()*
ny
;
h
->Fill(
people
[ry],
month
[rx],1);
}
h
->LabelsDeflate(
"X"
);
h
->LabelsDeflate(
"Y"
);
h
->LabelsOption(
"v"
);
h
->Draw(
"text"
);
TPaveText
*
pt
=
new
TPaveText
(0.6,0.85,0.98,0.98,
"brNDC"
);
pt
->
SetFillColor
(18);
pt
->
SetTextAlign
(12);
pt
->
AddText
(
"Use the axis Context Menu LabelsOption"
);
pt
->
AddText
(
" \"a\" to sort by alphabetic order"
);
pt
->
AddText
(
" \">\" to sort by decreasing values"
);
pt
->
AddText
(
" \"<\" to sort by increasing values"
);
pt
->
Draw
();
return
c1
;
}
h
#define h(i)
Definition
RSha256.hxx:106
Int_t
int Int_t
Definition
RtypesCore.h:45
TRangeDynCast
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Definition
TCollection.h:358
gRandom
R__EXTERN TRandom * gRandom
Definition
TRandom.h:62
ROOT::Detail::TRangeCast
Definition
TCollection.h:311
TAttFill::SetFillColor
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition
TAttFill.h:37
TAttText::SetTextAlign
virtual void SetTextAlign(Short_t align=11)
Set the text alignment.
Definition
TAttText.h:42
TCanvas
The Canvas class.
Definition
TCanvas.h:23
TH1::kAllAxes
@ kAllAxes
Definition
TH1.h:76
TH2F
2-D histogram with a float per channel (see TH1 documentation)
Definition
TH2.h:307
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:191
TPaveText::Draw
void Draw(Option_t *option="") override
Draw this pavetext with its current attributes.
Definition
TPaveText.cxx:242
TRandom::SetSeed
virtual void SetSeed(ULong_t seed=0)
Set the random generator seed.
Definition
TRandom.cxx:615
TRandom::Rndm
Double_t Rndm() override
Machine independent random number generator.
Definition
TRandom.cxx:559
pt
TPaveText * pt
Definition
entrylist_figure1.C:7
c1
return c1
Definition
legend1.C:41
Author
Rene Brun
Definition in file
hlabels2.C
.
tutorials
hist
hlabels2.C
ROOT tags/6-34-04 - Reference Guide Generated on Wed Mar 26 2025 04:46:35 (GVA Time) using Doxygen 1.10.0