Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
hist038_TH2Poly_honeycomb.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_hist
3/// \notebook -js
4/// This tutorial illustrates how to create an histogram with hexagonal
5/// bins (TH2Poly). The method TH2Poly::Honeycomb allows to build automatically
6/// an honeycomb binning.
7///
8/// \macro_code
9/// \macro_image
10///
11/// \date August 2023
12/// \author Olivier Couet
13
15{
16 TCanvas *C = new TCanvas("C", "C", 1200, 600);
17 C->Divide(2, 1);
18
19 TH2Poly *hc1 = new TH2Poly();
20 hc1->Honeycomb(0, 0, .1, 5, 5);
21 hc1->SetTitle("Option V (default)");
22 hc1->SetStats(0);
23 hc1->Fill(.1, .1, 15.);
24 hc1->Fill(.4, .4, 10.);
25 hc1->Fill(.5, .5, 20.);
26
27 TH2Poly *hc2 = new TH2Poly();
28 hc2->Honeycomb(0, 0, .1, 5, 5, "h");
29 hc2->SetTitle("Option H");
30 hc2->SetStats(0);
31 hc2->Fill(.1, .1, 15.);
32 hc2->Fill(.4, .4, 10.);
33 hc2->Fill(.5, .5, 20.);
34
35 C->cd(1)->SetGrid();
36 hc1->Draw("colz L");
37 C->cd(2)->SetGrid();
38 hc2->Draw("colz L");
39}
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
The Canvas class.
Definition TCanvas.h:23
2D Histogram with Polygonal Bins
Definition TH2Poly.h:66
constexpr Double_t C()
Velocity of light in .
Definition TMath.h:114