This macro demonstrates semi-transparent pads.
One uses fill styles between 4000 and 4100 to configure objects transparency On OpenGL or Mac/Cocoa or Web-based canvas pads will be drawn with transparent colors. On X11 pixmap transformation performed to partially emulate pads transparency Also demonstrated usage of transparent fill styles for stats box
{
auto c1 =
new TCanvas(
"c1",
"transparent pad demo", 10, 10, 900, 500);
if (!
c1->UseGL() && !
c1->IsWeb() && !
gVirtualX->InheritsFrom(
"TGCocoa"))
"To have real transparency in a canvas graphics, you need either OpenGL or Mac/Cocoa or Web rendering enabled");
auto h1 =
new TH1F(
"TH1F 1",
"TH1F 1", 100, -1.5, 1.5);
auto h2 =
new TH1F(
"TH1F 2",
"TH1F 2", 100, -1.5, 0.);
h2->FillRandom("gaus");
auto h3 =
new TH1F(
"TH1F 3",
"TH1F 3", 100, 0.5, 2.);
h3->FillRandom(
"landau");
auto pad1 =
new TPad(
"transparent pad 1",
"transparent pad 1", 0.1, 0.1, 0.7, 0.7);
pad1->SetFillStyle(4040);
auto pad2 =
new TPad(
"transparent pad 2",
"transparent pad 2", 0.2, 0.2, 0.8, 0.8);
pad2->SetFillStyle(4035);
auto pad3 =
new TPad(
"transparent pad 3",
"transparent pad 3", 0.3, 0.3, 0.9, 0.9);
pad3->SetFillStyle(4030);
}
}
}
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
R__EXTERN TStyle * gStyle
1-D histogram with a float per channel (see TH1 documentation)
virtual void FillRandom(TF1 *f1, Int_t ntimes=5000, TRandom *rng=nullptr)
The most important graphics class in the ROOT system.
The histogram statistics painter class.
void SetFrameFillStyle(Style_t styl=0)
void SetCanvasPreferGL(Bool_t prefer=kTRUE)
- Authors
- Timur Pocheptsov, Sergey Linev
Definition in file transparentpad.C.