void print(){ TCanvas* c = new TCanvas("c","c",0,0,700,500); TH1F* hframe = c->DrawFrame(0,0,1,1); // using a pointer the text will stay TLatex* tex1 = new TLatex( 0.25, 0.50, "text stays" ); tex1->SetNDC(); tex1->Draw(); // the text will disappear if not using a pointer TLatex tex2( 0.50, 0.50, "text disappears" ); tex2.SetNDC(); tex2.Draw(); gSystem->Sleep(1000); c->Modified(); c->Update(); gSystem->Sleep(1000); }