This macro demonstrates semi-transparent pads.
Requires OpenGL.
void transparentpad()
{
::Error(
"transparentpad",
"failed to create new custom colors");
return;
}
TCanvas *
const c1 =
new TCanvas(
"transparent pad",
"transparent pad demo", 10, 10, 900, 500);
::Warning(
"transparentpad",
"You can see the transparency ONLY in a pdf or png output (\"File\"->\"Save As\" ->...)\n"
"To have transparency in a canvas graphics, you need OpenGL rendering enabled");
}
new TColor(indices[0], 1., 0.2, 0.2,
"transparent_pink", 0.25);
new TColor(indices[1], 0.2, 1., 0.2,
"transparent_green", 0.25);
new TColor(indices[2], 0.2, 2., 1.,
"transparent_blue", 0.15);
TH1F *
const h1 =
new TH1F(
"TH1F 1",
"TH1F 1", 100, -1.5, 1.5);
TH1F *
const h2 =
new TH1F(
"TH1F 2",
"TH1F 2", 100, -1.5, 0.);
TH1F *
const h3 =
new TH1F(
"TH1F 3",
"TH1F 3", 100, 0.5, 2.);
TPad *
const pad1 =
new TPad(
"transparent pad 1",
"transparent pad 1", 0.1, 0.1, 0.7, 0.7);
TPad *
const pad2 =
new TPad(
"transparent pad 2",
"transparent pad 2", 0.2, 0.2, 0.8, 0.8);
TPad *
const pad3 =
new TPad(
"transparent pad 3",
"transparent pad 3", 0.3, 0.3, 0.9, 0.9);
}
void Error(const char *location, const char *msgfmt,...)
void Warning(const char *location, const char *msgfmt,...)
R__EXTERN TStyle * gStyle
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
The color creation and management class.
1-D histogram with a float per channel (see TH1 documentation)}
virtual void FillRandom(const char *fname, Int_t ntimes=5000)
Fill histogram following distribution in function fname.
virtual void Draw(Option_t *option="")
Draw this histogram with options.
The most important graphics class in the ROOT system.
virtual void Draw(Option_t *option="")
Draw Pad in Current pad (re-parent pad if necessary).
TVirtualPad * cd(Int_t subpadnumber=0)
Set Current pad.
void SetCanvasPreferGL(Bool_t prefer=kTRUE)
unsigned FindFreeCustomColorIndices(T(&indices)[N])