This macro shows how to create and use linear gradients to fill a histogram or a pad.
void grad()
{
::Error(
"grad",
"failed to create new custom colors");
return;
}
TCanvas *
const cnv =
new TCanvas(
"gradient demo 1",
"gradient demo 1", 100, 100, 600, 600);
::Error(
"grad",
"This macro works only on MacOS X with --enable-cocoa");
delete cnv;
return;
}
const Color_t &frameGradient = colorIndices[2];
{
new TColor(colorIndices[0], 0.25, 0.25, 0.25,
"special pad color1", 0.55);
new TColor(colorIndices[1], 1., 1., 1.,
"special pad color2", 0.05);
const Double_t locations[] = {0., 0.2, 0.8, 1.};
const Color_t gradientIndices[4] = {colorIndices[0], colorIndices[1], colorIndices[1], colorIndices[0]};
}
const Color_t &padGradient = colorIndices[3];
{
const Color_t gradientIndices[2] = {30, 38};
}
const Color_t &histGradient = colorIndices[4];
{
const Double_t locations[3] = {0., 0.5, 1.};
}
TH1F *
const hist =
new TH1F(
"a1",
"b1", 20, -3., 3.);
}