Hi,
I have a problem with getting the right size for a label which I want to draw. The goal is to create the label and then move it to the right position taking account for the size of the label.
So I started to write a script:
[code]TLatex * test_function (TH2D * img) {
img->Draw(“colz”);
TLatex * label = new TLatex ( 10, 10, “asdf” );
cout << "GetXsize() = " << label->GetXsize() << endl;
return label;
}[/code]
and when I call the function, the following happens:
root [2] label = test_function(data_histo)
Info in <TCanvas::MakeDefCanvas>: created default TCanvas with name c1
GetXsize() = 0.066092
(class TLatex*)0x30d5cc0
root [3] label->GetXsize()
(Double_t)1.04260059024860382e+02
I am confused, I don’t understand the return value of GetXsize(): in the documentation it says, GetXsize() would return the size in pad coordinates. However, there is only one pad involved here, why do I get two different results? And moreover, the result in the script is obviously wrong - 0.07 would be invisible…
Can anyone help here? Thanks a lot in advance!