About the behavior of TPaveText::Clear()

the member function TPaveText::Clear() clears all the text on the pave, but after using TPaveText::AddText(), I don’t get what I want.

code:
{
TH1F h1= new TH1F(“h1”,“histogram 1”,100,-5,5);
h1->FillRandom(“gaus”,10000);
h1->Draw();
gPad->Update();
TPaveText
title = (TPaveText*)gPad->FindObject(“title”);
title->Clear();
title->AddText(“any text”);
gPad->Modified();
}
the text on the pave is not “any text”, but still the title of histogram h1: “histogram 1”.
why is this?

You are trying to change the title pave, why not simply using SetTitle ?

I’ve solved the problem, thank you!
h1->SetTitle(“any text”) will work! :smiley: