Re: [ROOT] how to change the "title" of a pad

From: Rene Brun (Rene.Brun@cern.ch)
Date: Sun Feb 24 2002 - 19:21:41 MET


Hi Jacek,

As usual, you are right. I fixed all the problems you reported in
the current version in CVS. More details below

Rene Brun

On Sun, 24 Feb 2002, Jacek M. Holeczek wrote:

> Hi,
> 
> (Well ... you asked for it :-)
> The ROOT is 3.02/07 RH6.2/i386 with egcs-1.1.2.
> 
> > NO. The Latex characters are taken into account. Could you send me a
> > short example where the pavetext is too wide?
> Observe :
> 	Float_t x[3] = {1,2,3}
> 	Float_t y[3] = {10,20,30}
> 	TGraph *g1 = new TGraph(3,x,y)
> 	TGraph *g2 = new TGraph(3,x,y)
> 	g1->SetTitle("XabgdeY")
> 	g2->SetTitle("X#alpha#beta#gamma#delta#epsilonY")
> 	new TCanvas()
> 	g1->Draw("AL")
> 	new TCanvas()
> 	g2->Draw("AL")
> See the "title" TPaveText in both canvases (and the fLongest data member).
> Try the same with a TMultiGraph instead of TGraph (should be the same
> problem).
> 

The problem was in THistPainter::PaintTitle. I am now using the
TLatex::GetXsize function to evaluate precisely the text extent along x.
In your original mail, I thought that you were using a TPaveText directly.


> > (...) MyGraph->GetXaxis() will return 0.
> That would be very nice ...  however ...
> Observe :
> 	Float_t x[3] = {1,2,3}
> 	Float_t y[3] = {10,20,30}
> 	TGraph *g1 = new TGraph(3,x,y)
> 	g1->Draw()
> 	g1->GetXaxis() //  *** Break *** segmentation violation
> or :
> 	Float_t x[3] = {1,2,3}
> 	Float_t y1[3] = {10,20,30}
> 	Float_t y2[3] = {11,22,33}
> 	TGraph *g1 = new TGraph(3,x,y1)
> 	TGraph *g2 = new TGraph(3,x,y2)
> 	TMultiGraph *mg = new TMultiGraph("MMG", "My MultiGraph")
> 	mg->Add(g1)
> 	mg->Add(g2)
> 	mg->Draw()
> 	mg->GetXaxis() //  *** Break *** segmentation violation
> 	mg->Draw("L")
> 	mg->GetXaxis() //  *** Break *** segmentation violation
> 	g1->GetXaxis() //  *** Break *** segmentation violation
> 	mg->Draw("A")
> 	mg->GetXaxis() // NO segmentation fault any more
> 	g1->GetXaxis() //  *** Break *** segmentation violation
> If you want to have more fun ... try the above sequence without these two
> lines "mg->Add(...)" (leave the TMultiGraph mg "completely empty") ...


All these case are now protected (calling Draw with no options or illegal 
options (not your case)).

> 
> How about my problem that when I interactively zoom one of pads (x- or
> y-axis), all the others are also affected. No simple way to make their
> axises "independent" ?

Zooming on an axis modifies the internal axis attributes (fFirst,fLast).
You should use the DrawCopy functions to avoid this side-effect.

Rene Brun

> 
> Thanks in advance,
> Best regards,
> Jacek.
> 



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