ROOT logo

From $ROOTSYS/tutorials/gl/glh3c.C

// Display a 3D histogram using GL (box option).
//Author: Timur Pocheptsov
void glh3c()
{
  gStyle->SetCanvasPreferGL(kTRUE);
  

  TGLTH3Composition * comp = new TGLTH3Composition;
  TH3F * h1 = new TH3F("h1", "h1", 10, -1., 1., 10, -1., 1., 10, -1., 1.);
  h1->FillRandom("gaus");
  h1->SetFillColor(kRed);
  TH3F * h2 = new TH3F("h2", "h2", 10, -1., 1., 10, -1., 1., 10, -1., 1.);
  h2->FillRandom("landau");
  h2->SetFillColor(kGreen);
  TH3F * h3 = new TH3F("h3", "h3", 10, -1., 1., 10, -1., 1., 10, -1., 1.);
  h3->FillRandom("gaus");
  h3->SetFillColor(kBlue);
  
  comp->AddTH3(h1);
  comp->AddTH3(h2, TGLTH3Composition::kSphere);
  comp->AddTH3(h3);

  comp->Draw();

  TPaveLabel *title = new TPaveLabel(0.04, 0.86, 0.96, 0.98,
                                     "TH3 composition.");
  title->SetFillColor(32);
  title->Draw();
}
 glh3c.C:1
 glh3c.C:2
 glh3c.C:3
 glh3c.C:4
 glh3c.C:5
 glh3c.C:6
 glh3c.C:7
 glh3c.C:8
 glh3c.C:9
 glh3c.C:10
 glh3c.C:11
 glh3c.C:12
 glh3c.C:13
 glh3c.C:14
 glh3c.C:15
 glh3c.C:16
 glh3c.C:17
 glh3c.C:18
 glh3c.C:19
 glh3c.C:20
 glh3c.C:21
 glh3c.C:22
 glh3c.C:23
 glh3c.C:24
 glh3c.C:25
 glh3c.C:26
 glh3c.C:27
 glh3c.C:28
 glh3c.C:29
 glh3c.C:30
thumb