I’m interested in finding out the actual meaning of pad margins in regards to plotting. While they seem to be the distance between the edge of the pad and the histogram axes, when the axes have labels this relationship is broken. It’s not clear how can I obtain the actual distance between axis and pad edge in this case since the titles can be controlled with offset and it’s unclear what is the standard axis-to-title offset in NDC terms. Similarly, a way to get the actual width and height of the histogram frame excluding the title in NDC terms would be great.
I need this to write some text placement using the DrawLatexNDC methods. Trial and error is clearly not affordable due to sensitivity wrt canvas aspect ratio.
{
auto c = new TCanvas("c","c");
c->SetRightMargin(0.25); // right margin is 1/4 of the canvas
c->SetLeftMargin(0.25); // left margin is 1/4 of the canvas
c->DrawFrame(-5,-5,5,5);
auto *line = new TLine();
line->SetLineColor(2);
line->SetLineStyle(2);
line->SetLineWidth(2);
line->DrawLineNDC(.5,0.,.5,1.); // line in the middle
line->DrawLineNDC(.75,0.,.75,1.); // line on the right margin
line->DrawLineNDC(.25,0.,.25,1.); // line on the left margin
}
Ok turned out you are absolutely right, it does line up perfectly. For TLine.
However, I don’t understand then why is the TLatex not drawn at the same point as the line, but instead a bit to the left? MWE as attached, line 201 is where the TLatex drawing happens.