Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
th2polyHoneycomb.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/// \author Olivier Couet
12
13void th2polyHoneycomb(){
14 TCanvas *C = new TCanvas("C", "C", 1200, 600);
15 C->Divide(2,1);
16
17 TH2Poly *hc1 = new TH2Poly();
18 hc1->Honeycomb(0, 0, .1, 5, 5);
19 hc1->SetTitle("Option V (default)");
20 hc1->SetStats(0);
21 hc1->Fill(.1, .1, 15.);
22 hc1->Fill(.4, .4, 10.);
23 hc1->Fill(.5, .5, 20.);
24
25 TH2Poly *hc2 = new TH2Poly();
26 hc2->Honeycomb(0, 0, .1, 5, 5, "h");
27 hc2->SetTitle("Option H");
28 hc2->SetStats(0);
29 hc2->Fill(.1, .1, 15.);
30 hc2->Fill(.4, .4, 10.);
31 hc2->Fill(.5, .5, 20.);
32
33 C->cd(1)->SetGrid();
34 hc1->Draw("colz L");
35 C->cd(2)->SetGrid();
36 hc2->Draw("colz L");
37}
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