i have been searching for a solution for many hours but i did not find nothing or i simply have not been able to interpret the solutions.
I want to position a legend with respect to the histogram or plot coordinates. Unfortunately (in this special case) the standard coordinates for a TLegend object are set to NDC coordinates and i can not figure out how to set them to the coordinates of my histogram axes.
Please do not simply give a reference to the TPad documentation where on can find the conversion functions since i have been there many times and could not figure out how to use them properly in order to achieve what i want.
Thank you in advance.
NDC is in fact a % of the pad size. Simply get the histogram coordinates (min and max) and do a % according to the coordinate you want. It should work. For a more complete help you better provide a small macro showing what you have now.
thank you, the hint of couet was of great help. This issue can be considered solved.
What follows is a little description of what i did exactly for other people being confronted with this issue.
What i used was the fact that for my case in NDC coordinates the left margin of the histogram is located at 0.1 while the right margin is located at 0.9. Same holds for the top and bottom margin.
This leads to the width and height of the histogram in NDC coordinates which is 0.8.
Next i figured out what is my x-min and x-max (y-min and y-max accordingly) in the coordinates of the plot.
Now for example if i wanted the right margin of the legend being located at x in the coordinates of the plot i obtain the NDC coordinate by doing
DX = xmax-xmin
NDC-coord = 0.1 + x/DX * 0.8