This example demonstrates how to use the accessible color schemes with THStack.
In this example, the color scheme with six colors is used. It also shows that the grayscale version is an acceptable alternative.
void hist026_THStack_color_scheme()
{
auto hs =
new THStack(
"hs",
"Stacked 1D histograms colored using 6-colors scheme");
auto h1st =
new TH1F(
"h1st",
"A", 100, -4, 4);
h1st->FillRandom("gaus", 20000);
hs->Add(h1st);
auto h2st =
new TH1F(
"h2st",
"B", 100, -4, 4);
h2st->FillRandom("gaus", 15000);
hs->Add(h2st);
auto h3st =
new TH1F(
"h3st",
"C", 100, -4, 4);
h3st->FillRandom("gaus", 10000);
hs->Add(h3st);
auto h4st =
new TH1F(
"h4st",
"D", 100, -4, 4);
h4st->FillRandom("gaus", 10000);
hs->Add(h4st);
auto h5st =
new TH1F(
"h5st",
"E", 100, -4, 4);
h5st->FillRandom("gaus", 10000);
hs->Add(h5st);
auto h6st =
new TH1F(
"h6st",
"F", 100, -4, 4);
h6st->FillRandom("gaus", 10000);
hs->Add(h6st);
hs->Draw();
hs->Draw();
}
1-D histogram with a float per channel (see TH1 documentation)
- Date
- October 2024
- Author
- Olivier Couet
Definition in file hist026_THStack_color_scheme.C.