21 std::vector<double>
negative = {-5, -7, -3, -1};
22 std::vector<double>
positive = {2, 15, 2, 10};
23 std::vector<std::string> labels = {
"Category 1",
"Category 2",
"Category 3",
"Category 4"};
30 auto hmain =
new TH1D(
"hmain",
"title", nbins, 0, nbins);
31 hmain->SetMarkerSize(3);
32 hmain->SetMarkerStyle(33);
35 auto hpos =
new TH1D(
"hpos",
"title", nbins, 0, nbins);
37 hpos->SetBarOffset(0.2);
38 hpos->SetBarWidth(0.6);
40 auto hneg =
new TH1D(
"hneg",
"title", nbins, 0, nbins);
42 hneg->SetBarOffset(0.2);
43 hneg->SetBarWidth(0.6);
47 for (
unsigned n = 0;
n < nbins;
n++) {
60 auto haxis =
new TH1D(
"haxis",
"title", nbins, 0, nbins);
63 haxis->SetStats(
false);
64 for (
unsigned n = 0;
n < nbins;
n++)
65 haxis->GetXaxis()->SetBinLabel(
n + 1, labels[
n].c_str());
66 haxis->GetXaxis()->SetTickSize(0);
67 haxis->GetXaxis()->SetLabelSize(0.07);
68 haxis->GetXaxis()->SetLabelOffset(0.02);
70 auto c1 =
new TCanvas(
"chaxis",
"title", 1500, 800);
72 if (!
gROOT->IsBatch() && !
c1->IsWeb())
73 ::Warning(
"haxis.cxx",
"macro may not work without enabling web-based canvas");
84 c1->Add(
hpos,
"bar,base0,same");
85 c1->Add(
hneg,
"bar,base0,same");
109 l->SetTextSize(0.03);
118 auto box =
new TBox(0.2, 6, 0.8, 14);
121 box->SetLineWidth(3);
123 c1->Add(
box,
"l,frame");
125 auto l1 =
new TLatex(0.5, 10,
"Text inside frame");
126 l1->SetTextAlign(22);
127 l1->SetTextSize(0.04);
130 c1->Add(
l1,
"frame");
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void xpos
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void ypos
virtual void SetTextAlign(Short_t align=11)
Set the text alignment.
virtual void SetTextColor(Color_t tcolor=1)
Set the text color.
virtual void SetTextSize(Float_t tsize=1)
Set the text size.
1-D histogram with a double per channel (see TH1 documentation)
To draw Mathematical Formula.
virtual void SetNDC(Bool_t isNDC=kTRUE)
Set NDC mode on if isNDC = kTRUE, off otherwise.
Defined by an array on N points in a 2-D space.
virtual void SetNDC(Bool_t isNDC=kTRUE)
Set NDC mode on if isNDC = kTRUE, off otherwise.
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)