Re: THStack: draw slices with different colors

From: Rene Brun <brun_at_pcroot.cern.ch>
Date: Sat, 16 Apr 2005 13:07:38 +0200 (MEST)


Hi Valery,

see the example below. You can change the color setting algorithm.

Rene Brun

void hsp() {

   TFile *f = new TFile("hsimple.root");    TH2 *hpxpy = (TH2*)f->Get("hpxpy");
   THStack *h = new THStack(hpxpy);
   TIter next(h->GetHists());
   TH1 *h1;
   gStyle->SetPalette(1);
   Int_t i =0;
   while ((h1 = (TH1*)next())) {

      h1->SetFillColor(i);
      i++;

   }
   h->Draw("nostack");
}       

On Sat,
16 Apr 2005, Valery Dorofeev wrote:

>
> Dear Rootters,
>
> I found a nice possibility to draw slices of 2-dim. hist. using THStack
> class. It is really wonderfull.
> Is it possible to draw slices, say, in the "nostack" mode with different
> colors? I haven't found this possibility. As far as i understand one have
> to set various graphical primitives for each histogram by hand and this
> feature spoils the advantage of using the THStack for drawing slices of
> the THn(n>1).
> Valery.
>
>
Received on Sat Apr 16 2005 - 13:07:42 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:07 MET