Re: Histogram title

Rene Brun (Rene.Brun@cern.ch)
Fri, 07 Mar 1997 08:50:54 +0100


Chris Green wrote:
>
> >
> > > Finally, what's the easiest way of shading in an area on a histogram > in a specific colour / shading pattern?
> > >
> >
> > Click on the histogram with the rigth mouse button and select
> > the item "SetFillAttributes". This will display a panel with
> > colors, fill styles,etc.
> > In a macro, you can do:
> > h->SetFillColor(color);
> > h->SetFillStyle(3001);
>
> Thanks for all that, however for the last question what I actually want to
> do is shade in an arbitrary area (defined by points) which isn't defined
> on the histogram. ie take the example where I have an exclusion region for
> a search in 2D parameter space, and also want to shade off kinematically
> excluded regions without altering the contents of the histogram. In
> summary, I want to make a primitive filled area with a different shading
> style to the rest of the histogram.

To fill an arbitrary fill area on the existing picture, you can create
a TGraph object
gr = new TGraph(n,x,y)
where x and y are the n coordinates of the fill area.
gr->SetFillStyle(3002); // or any other fill style
gr->SetFillColor(2); // or any other color
gr->Draw("F"); // draw graph with fill area option

In version 1.0, I have added the possibility to draw subranges
of 1-d, 2-D histograms. To draw a subrange of an histogram with
a color and style, you will
- draw the original full picture
- select the histogram range
- draw again with option same

Rene Brun