This macro generates two RH1D, fills them and draw in RCanvas.
Second histogram uses enables "secondy" attribute to draw separate Y axis on right side
#include "ROOT/RFrameTitle.hxx"
void rh1_twoscales()
{
auto pHist1 = std::make_shared<RH1D>(xaxis);
auto pHist2 = std::make_shared<RH1D>(xaxis);
auto canvas = RCanvas::Create("RH1 with two Y scales");
auto col1 = RColor::kRed, col2 = RColor::kBlue;
canvas->Draw<RFrameTitle>("Two independent Y axes for histograms");
auto draw1 = canvas->Draw(pHist1);
draw1->line.color = col1;
draw1->line.width = 2;
auto draw2 = canvas->Draw(pHist2);
draw2->secondy = true;
draw2->line.color = col2;
draw2->line.width = 4;
canvas->GetFrame()->y.ticks.color = col1;
canvas->GetFrame()->y2.ticks.color = col2;
canvas->SetSize(800, 600);
canvas->Show();
}
R__EXTERN TRandom * gRandom
Objects used to configure the different axis types.
virtual Double_t Gaus(Double_t mean=0, Double_t sigma=1)
Samples a random number from the standard Normal (Gaussian) Distribution with the given mean and sigm...
- Date
- 2021-05-17
- 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 rh1_twoscales.cxx.