Re: [ROOT] TMultiGraph error in connection with GetAxis

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Mar 18 2003 - 21:44:20 MET


Hi Michael,

When the axis range is computed from the object content, eg
  -y axis for a TH1, TGraph, TMultiGraph,
  -z axis for a TH2

you must call the SetMaximum/SetMinimum functions of the object.
In your case, instead of:

   mGc->GetYaxis()->SetRangeUser(0,30);
do
  mGc->SetMinimum(0);
  mGc->SetMaximum(30);
or use the mouse on the y axis directly

Rene Brun

On 18 Mar 
2003, 
Michael T. Gericke wrote:

> Hi ROOTers,
> 
> 
> I am plotting some data, using the code excerpt below.
> To change the range on my axes, I use the SetRangeUser(...)
> function for the particular axis.
> This works fine for the X-axis, but nothing happens for
> the Y-axis.
> 
> Does anyone know how to do this?
> 
> Thanks,
> 
> Michael
> 
> 
> TMultiGraph *mGc = new TMultiGraph();
>   mGc->Add(gr2c);
>   mGc->Add(gr3c);
>   mGc->Draw("AP");
>   mGc->SetTitle("Cs Background Fit (Detector 210)");
>   mGc->GetXaxis()->SetRangeUser(1400,1940);
>   mGc->GetYaxis()->SetRangeUser(0,30);
>   mGc->GetXaxis()->SetTitle("Channel");
>   mGc->GetYaxis()->SetTitle("Count (x 1000)");
>   mGc->GetXaxis()->CenterTitle();
>   mGc->GetYaxis()->CenterTitle();
> 
> 
> 



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:10 MET