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

ROHLFS Reiner (Reiner.Rohlfs@obs.unige.ch)
Thu, 30 Oct 1997 16:17:50 +0100 (MET)


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.

Cheers Reiner.