Re: What does Update() and Modified() do with TGaxis?

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Oct 30 1997 - 18:33:09 MET


ROHLFS Reiner wrote:

> Hi Rooters,
>
> I'm drawing my own TGaxis in a program. In some cases, depending on the lowest
> (wmin) and highest (wmax) values for the tick marks these values are changed on
> the axis after I resize the window.
>
> Here is a macro to demonstrate that:
>
> {
>    gROOT->Reset();
>
>    c1 = new TCanvas("c1","canvas",50,10,400,500);
>
>    pad = new TPad("p", "pname", 0.05, 0.05, 0.95, 0.95);
>    pad->Draw();
>
>    pad->cd();
>    pad->DrawFrame(0.0,0.0, 1.0, 1.0);
>
>    axis1 = new TGaxis(0.5, 0., 0.5 , 1., 1.85, 3.65, 510, "");
>    axis1->Draw();
>
>    axis2 = new TGaxis(0.25, 0., 0.25 , 1., 5., 8., 510, "");
>    axis2->Draw();
>
> //   pad->Update();
> //   pad->Modified();
>
> }
>
> First both axis are drawn as expected. But after you resize the window or the
> pad axis1 only has a range from 2.0 to 3.6 instead from 1.85 to 3.65 like
> before. axis2 makes no problems.
>
> I found that calling pad->Update() and pad->Modified() has the same effect. For
> test you can uncomment these lines.
>
> You can avoid this change of the range with the "N" option:
>
>    axis1 = new TGaxis(0.5, 0., 0.5 , 1., 1.85, 3.65, 510, "N");
>
> But now you do not have the bining optimization, which I would like to use.
>

This problem appears when the the wmin,wmax of the axis (eg, 1.85,3.65)
do not correspond to the real pad coordinate system.
I have fixed the problem in my  development version 1.03/07.
Thanks for reporting.

Rene Brun



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