This macro generates really large RH2D histogram, fills it with predefined pattern and draw it in a RCanvas, using Optmize() drawing mode.
#include "ROOT/RFrameTitle.hxx"
void rh2_large()
{
const int nbins = 2000;
auto pHist = std::make_shared<RH2D>(xaxis, yaxis);
for(int i=0;i<nbins;++i)
for(int j=0;j<nbins;++j)
pHist->Fill({1.*i,1.*j}, i+j);
auto canvas = RCanvas::Create("Large 2000x2000 RH2 drawing");
auto frame = canvas->AddFrame();
frame->gridX = false;
frame->gridY = false;
frame->x.zoomMin = nbins*0.2;
frame->x.zoomMax = nbins*0.8;
frame->y.zoomMin = nbins*0.2;
frame->y.zoomMax = nbins*0.8;
canvas->Draw<RFrameTitle>(
TString::Format(
"Large RH2D histogram with %d x %d bins",nbins,nbins).
Data());
auto draw = canvas->Draw(pHist);
draw->line.color = RColor::kLime;
draw->Color();
draw->optimize = true;
stat->fill.style = RAttrFill::kSolid;
canvas->SetSize(1000, 700);
canvas->Show();
}
#define R__LOAD_LIBRARY(LIBRARY)
RAttrValue< RColor > color
! fill color
Objects used to configure the different axis types.
RAttrFill fill
! fill attributes
const char * Data() const
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
- Date
- 2020-06-26
- 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 rh2_large.cxx.