Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
transp.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_gl
3/// This demo shows how to use transparency.
4///
5/// \macro_image(nobatch)
6/// \macro_code
7///
8/// \authors Timur Pocheptsov, Sergey Linev
9
10//Includes for ACLiC (cling does not need them).
11#include "TCanvas.h"
12#include "TColor.h"
13#include "TError.h"
14#include "TStyle.h"
15#include "TH1F.h"
16
17void transp(bool gl = true)
18{
19 auto redIndex = TColor::GetColor((Float_t) 1., 0., 0., 0.85);
20 auto greeIndex = TColor::GetColor((Float_t) 0., 1., 0., 0.5);
21
23 auto cnv = new TCanvas("trasnparency", "transparency demo", 600, 400);
24
25 auto hist = new TH1F("a5", "b5", 10, -2., 3.);
26 auto hist2 = new TH1F("c6", "d6", 10, -3., 3.);
27 hist->FillRandom("landau", 100000);
28 hist2->FillRandom("gaus", 100000);
29
30 hist->SetFillColor(redIndex);
31 hist2->SetFillColor(greeIndex);
32
33 cnv->cd();
34 hist2->Draw();
35 hist->Draw("SAME");
36}
float Float_t
Definition RtypesCore.h:57
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
R__EXTERN TStyle * gStyle
Definition TStyle.h:433
The Canvas class.
Definition TCanvas.h:23
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
Definition TColor.cxx:1839
1-D histogram with a float per channel (see TH1 documentation)
Definition TH1.h:621
void SetCanvasPreferGL(Bool_t prefer=kTRUE)
Definition TStyle.h:339