Macro illustrating how to superimpose two histograms with different scales on the RCanvas.
It shows exactly same data as in hist/twoscales.C macro, but with fully interactive graphics
void th1_twoscales()
{
auto h1 = std::make_shared<TH1F>(
"h1",
"Example histogram",100,-3,3);
h1->SetDirectory(
nullptr);
for (
int i=0;
i<10000;
i++)
auto hint1 = std::make_shared<TH1F>("hint1","h1 bins integral",100,-3,3);
hint1->SetDirectory(nullptr);
for (
int i=1;
i<=100;
i++) {
hint1->SetBinContent(
i,
sum);
}
hint1->SetLineColor(
kRed);
hint1->GetYaxis()->SetAxisColor(
kRed);
hint1->GetYaxis()->SetLabelColor(
kRed);
canvas->Show();
}
R__EXTERN TRandom * gRandom
static std::shared_ptr< RCanvas > Create(const std::string &title)
Create new canvas instance.
Provides v7 drawing facilities for TObject types (TGraph, TH1, TH2, etc).
static uint64_t sum(uint64_t i)
- Date
- 2021-07-05
- Warning
- This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
- Author
- Sergey Linev s.lin.nosp@m.ev@g.nosp@m.si.de
Definition in file th1_twoscales.cxx.