Re: TGraph
Rene Brun (Rene.Brun@cern.ch)
Wed, 13 May 1998 12:40:57 +0200
Alexander Zvyagin wrote:
>
> IHEP, Protvino, Russia, 13-MAY-1998
>
> Dear ROOT team,
>
> I want to draw TGraph where range of axe X is x_max/x_min=1e6. It seems that
> graph axis has limitation x_max/x_min<1e3. Is it possible to overcome this
> limitation?
>
> Example of Macro:
>
> void e2(void)
> {
> gROOT->Reset();
>
> Float_t E_min=1e-3, E_max=1e3;
>
> const Int_t N_points_max = 1111;
> Int_t N_points;
> Float_t x[N_points_max],y[N_points_max],x_err[N_points_max],
> y_err[N_points_max];
>
> for( N_points=0; N_points<N_points_max; N_points++ )
> {
> x [N_points] = E_min+(E_max-E_min)*(Float_t)(N_points)
> /N_points_max;
> x_err [N_points] = 0;
> y [N_points] = 1;
> y_err [N_points] = 0;
> }
>
> TGraphErrors *graph = new TGraphErrors(N_points,x,y,x_err,y_err);
>
> c1 = new TCanvas("c1","Test",200,10,700,500);
>
> c1->SetLogx(1);
>
> graph->SetTitle("?????????????");
> graph->Draw("AP");
>
> c1->Update();
> }
Alexander,
The automatic computation of the axis range for TGraphs could
be improved. The current algorithm takes 3 decades by default
in case of log axis. It is easy to upgrade the algorithm to at least
do a better job in your case.
An easy solution for the time being is to replace your statement
graph->Draw("AP");
by
c1->DrawFrame(1,0.9,1000,2.1);
graph->Draw("P");
Rene Brun