Drawing an identical axis, shifted

I have a graph. I want to draw the X axis again, on top of the graph. I want to introduce a shift in this axis. Easy enough so far. Use a TGaxis, etc. I have this working so far.

The problem comes when I want to have the same number of divisions on the top axis as I have for the top[edit: Should read ‘Bottom’] axis. For some reason, ROOT likes to optimise them differently. So I tried turning optimisation off (Using SetNdivisions( n < 0 )). For a start, TGaxis doesn’t support turning off optimisation by setting a negative number of divisions. When I turn it on using the “N” option for chopt, I get an empty graph. Secondly, the un-optimised axis on the bottom looks bad.

Ideally, I would just copy the optimised number of divisions from the bottom axis to the top, but I see no way of doing this. If I try Painting the axis manually (with TGaxis::PaintAxis()), and getting the optimised (wmin, wmax, ndiv) by reference, I get nothing drawn.

I appreciate any help.


  • Peter


It would help if you could post a very short script illustrating what you are doing. Olivier will follow this as soon as he is back from holidays (tomorrow).