Hey,
im currently try to refine my plots. For instance, i wanna create a TPaveText with text “test” and put it in the upper left corner of my Pad. Since the coordinates used are “NDC”, how do i know in advance, where my text will be printed without trying?
Okay. Lets say i wanna “drag” the Text a little bit more to the left. I could do that with simply trying, but it doesnt seem right .
I found a temporary solution in which i print my TPad in a position near the desired location. After i plotted my histogram i take advantage of “user coordinates” and realign the position precisely.
Another Question: Can i determine the size of a string in some coord. depending on the text size?
Right now you are not using a Text but a TPaveText which is a box containing text. Pure text is done with TText or TLatex. You can have a look at the reference guide for these two classes to see how they work and yes they have methods returning the text size. You will find them in the doc.
Now using TPaveText is fine also. You can place the box containing the text where you want, either in user coordinates or NDC coordinate. To place it a bit more left you simply change the box coordinates . Using NDC coordinates (option NDC, you use it already in your example) is quite convenient when you want to place the box always at the same position independently of the user coordinates of your plot.
I do not understand why you need to do all this “gymnastic” with TPad to place the TPaveText… I guess I am missing something …
Thats the crucial point. It doesnt matter now because i changed my workflow. At first i thought i would be good practice to loop over my TTree and set the style at the same time. I guess that is not the right manner so i will shift my style setting in a separate file and now it is no problem to call my method twice to realign the textbox.
I appreciate your help.
Is there a way to get the size of a Legend entry (text+marker) in NDC?
And how can i adjust the number of divisions in the y axis in the lower pad in a ratioplot? Sth like
ratio->GetLowerRefGraph()->GetYaxis()->SetNdivisions(505) doesnt work. I cant even change it in the graphics editor.
I hope it is fine to post other questions here instead of opening a new topic respectively.
Thanks in advance.
Kevin
And how can i adjust the number of divisions in the y axis in the lower pad in a ratioplot? Sth like
ratio->GetLowerRefGraph()->GetYaxis()->SetNdivisions(505) doesnt work. I cant even change it in the graphics editor.
Yes you are right I cannot either. I have to check…