Logo ROOT  
Reference Guide
No Matches
th2polyHoneycomb.C File Reference

Detailed Description

View in nbviewer Open in SWAN
This tutorial illustrates how to create an histogram with hexagonal bins (TH2Poly).

The method TH2Poly::Honeycomb allows to build automatically an honeycomb binning.

void th2polyHoneycomb(){
TCanvas *C = new TCanvas("C", "C", 1200, 600);
TH2Poly *hc1 = new TH2Poly();
hc1->Honeycomb(0, 0, .1, 5, 5);
hc1->SetTitle("Option V (default)");
hc1->Fill(.1, .1, 15.);
hc1->Fill(.4, .4, 10.);
hc1->Fill(.5, .5, 20.);
TH2Poly *hc2 = new TH2Poly();
hc2->Honeycomb(0, 0, .1, 5, 5, "h");
hc2->SetTitle("Option H");
hc2->Fill(.1, .1, 15.);
hc2->Fill(.4, .4, 10.);
hc2->Fill(.5, .5, 20.);
hc1->Draw("colz L");
hc2->Draw("colz L");
The Canvas class.
Definition TCanvas.h:23
void SetTitle(const char *title) override
Change/set the title.
Definition TH1.cxx:6667
void Draw(Option_t *option="") override
Draw this histogram with options.
Definition TH1.cxx:3047
virtual void SetStats(Bool_t stats=kTRUE)
Set statistics option on/off.
Definition TH1.cxx:8817
2D Histogram with Polygonal Bins
Definition TH2Poly.h:66
Int_t Fill(Double_t x, Double_t y) override
Increment the bin containing (x,y) by 1.
Definition TH2Poly.cxx:589
void Honeycomb(Double_t xstart, Double_t ystart, Double_t a, Int_t k, Int_t s, Option_t *option="v")
Bins the histogram using a honeycomb structure If the option "v" is specified, the hexagons are drawn...
Definition TH2Poly.cxx:940
Olivier Couet

Definition in file th2polyHoneycomb.C.