Re: THStack: draw slices with different colors

From: Valery Dorofeev <Valery.Dorofeev_at_cern.ch>
Date: Sat, 16 Apr 2005 18:59:45 +0200 (CEST)


Dear Rene,
Thank you for your responce.

At first, sorry for i didn't notice the GetHists method.

That is what i was talking about. Before i have found THStack, i wrote a macro, which is doing the same and really no longer than yours, but without THStack.
I agree that my suggestion was rather stupid, for tastes are very different and one have to keep in mind drawing of a legend. But may be a DrawInColors method just for lazybones or beginners, although it violates polymorphysm.
Ok. Take it back. Sorry for disturbing you.

                                  Valery. 

On Sat, 16 Apr 2005, Rene Brun wrote:

> 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 - 18:59:50 MEST

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