Use same real size for object across different pads

Is there an absolute coordinate system that does not change depending on the chosen pad in a canvas? Let’s say that I have multiple pads (differently sized in general) in a canvas and I want to draw a legend in each of them. How can I set the same real (thus not relative to the pad) size for all these legends?

The legend is positioned in normalized coordinates. That makes it independent from the histogram coordinates and always positioned the same way relatively to the pad geometry.
There is no way in the TLegend class to position and “size” the legend in pixel for instance.
But if you give me some time I guess I can come with an example showing how to do it.

The attached macro does what you are looking for.
legend_size_in_pixel.C (648 Bytes)

I was about to implement the same trick, just wanted to know if there was a better way :slightly_smiling_face:
Thanks!

Right now this is the way to do it as TLegend does not have a constructor (native or inherited from TPave) working in pixel.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.