I would like to print multiple variables next to the histograms I produce. I’ve looked at the following thread
and this works perfectly for one variable. Is there a nice way of doing this for multiple variables, without having to create a new TText object each time?
I’ve looked into using TPaveText, but the AddText function doesn’t take variables as input (and converting everything to strings for function input is messy).
Unfortunately, I think the post you linked to solved the user’s problem by applying a right alignment to his text, along with using a string splitting function in some instances. However, since I’m using double/float variables rather than strings, string split wouldn’t be viable (unless I converted everything to strings first, which seems cumbersome).
Ideally, I’d like to have multiple TText lines, but without having to create a large number of TText objects. Do you have any other ideas?
Is there a command within the TLatex class that takes a variable as an argument, and plots it to the canvas? I’ve had a look at the documentation, and all I can find is something like DrawLatex or DrawText, which aren’t suitable.
For example, if I wanted to plot the number of entries of my histogram on the canvas, how would I go about doing that using TLatex, without having to manually type it in myself after running the code once already?
perhaps the number of entries is a bad example since this is displayed in the stats panel.
If you want to format a string which is the input of TLatex you can either use the traditional stl classes, e.g. std::string, or some ROOT building blocks such as root.cern.ch/doc/master/classTS … fbb7a3db70 .