[ROOT] Re: your mail

From: Claire Gwenlan (cg@hep.ucl.ac.uk)
Date: Sat Feb 24 2001 - 22:38:05 MET


Hi Rene,

I've kind of sorted out the problem but not quite. What I want is a shaded
band stretching right across the graph in the x-direction and from -1 to 1
in the y direction. So, I've created a TBox and drawn it, but what
happens, obviously, is that it draws over my points. Then when I try and
redraw the TGraph over the top to get my points back I can only do it if I
set no marker style. If I set no marker stylr and then go

gr->Draw("same")

It is OK, and the shaded box remains.

However, if I try

gr->Draw("samep")

then everything is completely wiped out and I no longer see the shaded box
(although of course the points are redrawn correctly but completely anew).

Why is this?

Cheers,

Claire


__________________________________
 Claire Gwenlan
 Department of Physics & Astronomy
 University College London
 Gower Street
 LONDON
 WC1E 6BT

 Tel: 020 7679 3454
_________________________________

On Sat, 24 Feb 2001, Rene Brun wrote:

> Hi Claire,
> It is not clear what you want to shade exactly.
> Here is an example from which you can get some inspiration.
> 
> Rene Brun
> 
> 
> {
>    gROOT->Reset();
>    Int_t nbins = 100;
>    TH1F *h1 = new TH1F("h1","h1",nbins,-3,3);
>    h1->FillRandom("gaus",10000);
>    h1->Draw();
>    TH1F *h2 = (TH1F*)h1->Clone();
>    Double_t mean = h1->GetMean();
>    Double_t rms  = h1->GetRMS();
>    for (Int_t i=1;i<=nbins;i++) {
>       Double_t x = h1->GetXaxis()->GetBinCenter(i);
>       if (x <mean-rms || x > mean+rms) h2->SetBinContent(i,0);
>    }
>    h2->SetFillColor(kRed);
>    h2->SetFillStyle(3013);
>    h2->Draw("same");
> }
> 
> On Sat, 24 Feb 2001, Claire Gwenlan wrote:
> 
> > 
> > Hi everybody,
> > 
> > Just wondering how to create a nice shaded band on a TGraph, for example a
> > band stretching from -1 to +1 to represent 1 standard deviation on a
> > graph.
> > 
> > Cheers,
> > 
> > Claire
> > 
> > __________________________________
> >  Claire Gwenlan
> >  Department of Physics & Astronomy
> >  University College London
> >  Gower Street
> >  LONDON
> >  WC1E 6BT
> > 
> >  Tel: 020 7679 3454
> > _________________________________
> > 
> > 
> 
> 



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:37 MET