Re: TGraph histogram options?

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Nov 07 1997 - 12:44:50 MET


Robert Casties wrote:

> Hello!
>
> I want to have a TGraph which looks like a histogram but I do not get
> along with the necessary TGraph options.
>
> I have a Float_t array FD with my (equidistant values).
>
> If I create another array XD with the x-axis values (bin numbers) and do
>   TGraph gr(nbins, XD, FD); gr.Draw("AL")
> I get a graph with straight lines joining the points (and the x range is
> somewhat extended). When I use gr.Draw("AB") I get boxes around every bin
> which is somewhat more but not entirely like a histogram.
>
> My question is how do I use the options of TGraph::PaintGraph and
> TGraph::PaintGrapHist?
>
> The documentation mentions the possibility to use min/max values for the
> axis, what data do I have to supply and how do I indicate this mode?
>
> If I call TGraph::PaintGrapHist it either segfaults or does nothing. What
> type of data do I have to supply and which options to choose? Why is there
> no "histogram" option to TGraph::Draw?
>
>

The graphics part of the classes TGraph and TGaxis are "relics"  ofthe early
Root prototype copied from the HIGZ functions IGGRAH
and IGAXIS.. The interface should be rewritten to be more consistent
with the other parts of the framework. This is on my  long list of things
to do.
In particular the current functions PaintGraph and PaintGrapHist
are functions designed to be used as service functions when drawing
higher level objects such as histograms. You cannot call them
directly with an object of the class TGraph..

The solution to your problem is to use TH1F objects instead.

Rene Brun



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:26:22 MET