Printing Variable on Canvas

I have a ROOT Canvas, where I need to print out a value of a variable I calculate in the ROOT Macro I run, preferably on the top right hand corner, or below the legend. My variable is defined in the macro.
Could you guide me how to print it on the canvas?
Many thanks,


Refer to this class:

root [0] TCanvas *c = new TCanvas();
root [1] double pi = 3.14
(double) 3.140000
root [2] TLatex *t = new TLatex(.5,.5,Form("#pi = %g",pi))
(TLatex *) 0x7f90a201f9b0
root [3] t->Draw()
1 Like

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