Remove TLatex from TGraph

Dear,

I used this method to add a TLatex to a TGraph TGraph Point Label

How may I remove it?

Thank you


Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


Right click on it and delete it.

Thank you for your reply.

Sorry for the misunderstanding, I mean once it’s added if I further need to remove it using C++ code.

Best regards,

Do you have the TLatex Definition in your code?

I have something like this:

TLatex* tlatex = new TLatex(x, y, "label");
tg->GetListOfFunctions()->Add(tlatex);

remove those lines?

The thing is I need to display the TGraph with the label and further without… I can indeed recreate the TGraph without, but I thought there was a “simple” way to simply remove the label.

GetListOfFunctions returns a TList. Use the Remove method of TList.

OK thank you I found a way to do it using:

gr->GetListOfFunctions()->Remove(
                gr->GetListOfFunctions()->LastLink()
);

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