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);
pHist1->Fill(
gRandom->Gaus(3,0.8));
pHist2->Fill(
gRandom->Gaus(7,1.2));
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.
static std::shared_ptr< RCanvas > Create(const std::string &title)
Create new canvas instance.
static R__DLLEXPORT constexpr RGB_t kRed
static R__DLLEXPORT constexpr RGB_t kBlue
- 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.