Use a THStack to show a 2-D hist with cells with different colors.
root > .x multicolor.C
root > .x multicolor.C(1)
void multicolor(
Int_t isStack=0) {
TH2F *
h1 =
new TH2F(
"h1",
"h1",nbins,-4,4,nbins,-4,4);
TH2F *h2 =
new TH2F(
"h2",
"h2",nbins,-4,4,nbins,-4,4);
TH2F *h3 =
new TH2F(
"h3",
"h3",nbins,-4,4,nbins,-4,4);
for (i=0;i<20000;i++)
h1->
Fill(
r.Gaus(),
r.Gaus());
for (i=0;i<200;i++) {
if (val <= 0) continue;
} else {
}
}
}
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
virtual Int_t GetBin(Int_t binx, Int_t biny=0, Int_t binz=0) const
Return Global bin number corresponding to binx,y,z.
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
virtual void SetBinContent(Int_t bin, Double_t content)
Set bin content see convention for numbering bins in TH1::GetBin In case the bin number is greater th...
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
2-D histogram with a float per channel (see TH1 documentation)}
virtual void SetBinContent(Int_t bin, Double_t content)
Set bin content.
The Histogram stack class.
virtual void Draw(Option_t *chopt="")
Draw this multihist with its current attributes.
virtual void Add(TH1 *h, Option_t *option="")
add a new histogram to the list Only 1-d and 2-d histograms currently supported.
This is the base class for the ROOT Random number generators.
- Author
- Rene Brun
Definition in file multicolor.C.