Re: LabelOffset

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Nov 28 1997 - 10:21:15 MET


ROHLFS Reiner wrote:

> Hi ROOTers,
>
> I want to draw a narrow but high graph. Here is my test macro:
>
> {
>   gROOT->Reset();
>
>   c1 = new TCanvas("c1","canvas",10,0,250,870);
>   pad = new TPad("", "", 0.0, 0.0, 1.0, 1.0);
>   pad->SetBottomMargin(0.05);
>   pad->SetTopMargin(0.01);
>   pad->Draw();
>   pad->cd();
>
>   Float_t x[3] = {1., 2.2, 3.};
>   Float_t y[3] = {1., 85.3, 120.};
>   graph = TGraph(3, x, y);
>   graph->Draw("AL");
>
>   pad->Update();
>   TAxis * axis = graph->GetXaxis();
>   axis->SetLabelSize(0.08);
>   axis->SetLabelOffset(0.);
>   pad->Modified();
> }
>
> The labels of the X - axis are NOT visible in this example because the offset
> is more than twice the size of the label characters. Even if I set the offset
> to 0.
>
> I want to use as much space as possible for the graph and as less as necessary
> for the labels. Therefore I set the BottomMargin to 0.05 which would be enough
> for the label size of 0.08.

Reiner,The current implementation does not take into account correctly the
combination
of label offset, size and label alignment. The algorithm is optimized for
pads/canvas
with a "screen-like" aspect ratio. I hope to find some time to optimize this
algorithm for a more general case. Also the position of the axis title is not
optimum.
I had several reports of overlapping between the title and the labels.
Meanwhile, I have made a "quick fix" to support negative offsets. You can play
with this parameter to optimize the position.

>
>
> While I was playing with this example I noticed an other strange behavior:
> When you set the labelOffset to a negative value the labels are still painted
> below the X - axis. But if you want to open the pop-up menu of the TAxis with
> the right mouse button, you have to move your mouse into the graph above the
> X-axis.
> For example set the labelOffset to -0.1 you have to move the mouse to the Y -
> position of approximately 10 in this example to be able to open the TAxis menu.

This small problem is now fixed in our development version (will appear as
1.03/09).

Rene Brun

>



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