NDC coordinates of a certain histo/graph point

Good day.

I’m trying to put some text on a plot with few histograms, near each line, and it seems the only way so far is to manually position it. I’m wondering, if there is a possibility to determine coordinates within the pad/canvas of a certain point from a histogram (or a graph), so I can then anchor my text label to it? I couldn’t find any way to do that. Thanks.

If you draw the text in the histogram coordinates it will be “anchor” to the histogram as you seems to want it.

I’m afraid you misunderstood me. I can draw text in whatever coordinate system ROOT has, but I need to know the coordinates of the point where the histogram marker is placed, in whatever coordinate system there is. And there seem to be no way to find these coordinates, which is surprising.

Just get the bin content, and bin position.
All the methods you need are in the TH1 class.

Dear experts,
I came to this thread because it sounds similar to what I need.
I would like to draw TPaveText whose “x2” coordinates match the “up edge” of a certain bin. Is it possible to achieve this in ROOT?
It looks like I need to get the NDC of a given bin or something similar.

Thanks in advance,

You do not want “NDC coordinates” (i.e. you want “User coordinates” -> just set “x2” to the value of the “upper-edge” of your bin).