Re: [ROOT] problem in Y axis description

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Apr 24 2002 - 15:02:52 MEST


Hi Jacek,

I agree that some improvement should be made in the automatic
algorithm. What do you think of the following proposal.
IN TAxis::SetLabelOffset, the offset is given in per cent
of the pad size and is the distance between the axis and
the labels. Currently TAxis::SetTitleOffset has the offset
parameter representing a relative scale (default=1).
offset=1.2 places the title 20 per cent away than the default position.
I could change the behaviour (still being bacward compatible).
If the offset is (say >0.5) I take the offset with the current meaning.
If the offset is <0.5, it will represent like in the case of
SetLabelOffset the distance (in per cent of the pad size) to the
left most character in all labels for the Y axis or the bottom
of the labekls for the X axis. In this way, one can avoid overlaps
between the title and the labels.

Rene Brun


On Wed, 24 Apr 2002, Jacek M. Holeczek wrote:

> Hi,
> 
> > Anyhow, for crazy cases like your example, you should not expect
> > the automatic algorithms to always give a good result.
> 
> O.K. I have another "crazy" example ...
> The following problem I have met MANY, MANY times ...
> Observe :
> 	{
> 	Float_t x[3] = {1,2};
> 	Float_t y1[3] = {0.0001,0.002};
> 	TGraph *g = new TGraph(2, x, y1);
> 	TCanvas *cE = new TCanvas("cE", "cE");
> 	TPad *pad0 = new TPad("pad0", "My Pad", 0.01, 0.51, 0.50, 0.99);
> 	pad0->Draw(); cE->Update();
> 	pad0->cd(); cE->Modified(); cE->Update();
> 	g->Draw("AC");
> 	g->GetHistogram()->SetXTitle("A VERY NICELY LOOKING X AXIS TITLE");
> 	g->GetHistogram()->SetYTitle("A VERY NICELY LOOKING Y AXIS TITLE");
> 	pad0->Update(); pad0->Modified(); cE->Update();
> 	cE->SaveAs("cE.ps");
> 	}
> See the attached gifs for the "default" result ...
> I ALWAYS NEED to solve this MANUALLY using :
> 	MyGraph->GetHistogram()->GetXaxis()->SetTitleOffset(MagicXValue);
> 	MyGraph->GetHistogram()->GetYaxis()->SetTitleOffset(MagicYValue);
> 
> I vote for solving this problem in a way that by "default" it will never
> appear, so that a casual user does not get this problem at all.
> 
> Best regards,
> Jacek.
> 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:51 MET