This ROOT 7 example demonstrates how to create a ROOT 7 canvas (RCanvas), divide on sub-sub pads and draw histograms there.
void subpads()
{
auto pHist1 = std::make_shared<RH1D>(xaxis);
auto pHist2 = std::make_shared<RH1D>(xaxis);
auto pHist3 = std::make_shared<RH1D>(xaxis);
for (
int n = 0;
n < 1000;
n++) {
}
auto canvas = RCanvas::Create("Sub-sub pads example");
auto subpads = canvas->Divide(2,2);
subpads[0][0]->Draw(pHist1)->line.color = RColor::kRed;
subpads[1][0]->Draw(pHist2)->line.color = RColor::kBlue;
subpads[0][1]->Draw(pHist3)->line.color = RColor::kGreen;
auto subsubpads = subpads[1][1]->Divide(2,2);
subsubpads[0][0]->Draw(pHist1)->line.color = RColor::kBlue;
subsubpads[1][0]->Draw(pHist2)->line.color = RColor::kGreen;
subsubpads[0][1]->Draw(pHist3)->line.color = RColor::kRed;
auto style = RStyle::Parse(
"frame {"
" gridX: true;"
" gridY: true;"
" ticksX: 2;"
" ticksY: 2;"
" x_labels_size: 0.05;"
" y_labels_size: 20;"
" y_labels_color: green;"
"}");
canvas->SetSize(1200, 600);
canvas->Show();
canvas->ClearOnClose(
style);
}
#define R__LOAD_LIBRARY(LIBRARY)
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
- 2018-03-13
- 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 subpads.cxx.