Re: Again: Set axis Titles

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Feb 19 1997 - 10:07:00 MET


Matthias Vitt wrote:
> 
> Hi,
> 
> Setting the axis title via the right mouse button is one thing. But if I
> have a TGraph object say "gr", the command
> 
>         gr->GetHistogram->SetXTitle("X axis");
> 
> produces an error message:
> 
>         illegal pointer to class object GetHistogram()
> 
> What is wrong here ? Using only "gr->GetHistogram();" works but has no
> effect.

Change the line above to:
        gr->GetHistogram()->SetXTitle("X axis");


> 
> Is it possible to use an histogram instead of the graph. Can you make
> fits using (x,y) pairs within a histogram or is it only possible to fit
> one set of values that is spread equally over a discrete number of
> channels (like in the tutorial-file multifit.C)? Any suggestions?
> 

If you have pairs of points (x,y), use the TGraph or TGraphErrors
classes. To fit use TGraph::Fit. You can set a range to fit
by specifying the range in the function you want to fit.

> Oh, a last one. there is a howto about using Postscript. When I use this
> and I try to change the size of the resulting  picture via "Range(8,8);"
> the code doesn't produce a picture that is 8 cm by 8 cm but a picture
> that has stil the default size.
>         Mats

In version 0.9, by default, the size of the Postscript picture
is computed to keep the aspect ratio on the screen.
You can create a Postscript object and set its size. Example
   TPostScript myps("file.ps");
   myps.Range(8,8);
   object->Draw();
   myps.Close();

In version 1.0, we have optimized the default. If your canvas
is horizontal, the Postscript file will automatically be in
Landscape mode.

> 
> P.S: Congratulations for "root", I really like it. Finally one can
> create plots whithout spending hours with a "point an click" interface.

Thanks
Rene Brun



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