This macro demonstrates semi-transparent pads.
Requires OS X and ROOT configured with –enable-cocoa.
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 OS X version with cocoa 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);
}
- Author
- Timur Pocheptsov
Definition in file transparentpad.C.