This macro generates really large RH1D histogram, fills it with predefined pattern and draw it in a RCanvas, using Optmize() drawing mode.
#include "ROOT/RFrameTitle.hxx"
void draw_rh1_large()
{
const int nbins = 5000000;
auto pHist = std::make_shared<RH1D>(xaxis);
for(int i=0;i<nbins;++i)
pHist->Fill(1.*i, 1000.*(2+
TMath::Sin(100.*i/nbins)));
auto canvas = RCanvas::Create("Canvas Title");
auto frame = canvas->GetOrCreateFrame();
frame->SetGridX(true).SetGridY(true);
frame->AttrX().SetZoom(nbins*0.2, nbins*0.8);
auto draw = canvas->Draw(pHist);
draw->AttrLine().SetColor(RColor::kLime);
draw->Hist();
draw->Optimize(true);
canvas->SetSize(1000, 700);
canvas->Show();
}
#define R__LOAD_LIBRARY(LIBRARY)
RAttrFill & SetColor(const RColor &color)
The fill color.
Objects used to configure the different axis types.
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-07-02
- 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 draw_rh1_large.cxx.