Dear Root Talk,
here is a simple one:
how do I remove a fit from a histogram?
Is the only way by resetting the histogram?
Along the same lines, what are the values TObject::Clear(Option_t* = “”) takes?
Thanks
Dear Root Talk,
here is a simple one:
how do I remove a fit from a histogram?
Is the only way by resetting the histogram?
Along the same lines, what are the values TObject::Clear(Option_t* = “”) takes?
Thanks
Maybe this help ?
{
TH1F *h1 = new TH1F("h1","",100,-5,5);
h1->FillRandom("gaus",10000);
h1->Draw();
h1->Fit("gaus");
Printf("before");
h1->GetListOfFunctions()->ls();
TF1 *fun = h1->GetFunction("gaus");
h1->GetListOfFunctions()->Remove(fun);
Printf("after");
h1->GetListOfFunctions()->ls();
gPad->Modified();
// or "all in one"
// h1->GetListOfFunctions()->Remove(h1->GetFunction("gaus"))
}
Jan
Thanks, that does
Any idea of what the options for TObject::Clear() would be?
Hi,
depends on what you are calling Clear() on, see e.g. root.cern.ch/root/html/TList#TList:Clear
Axel.
Very true, sorry for not being clearer.
I was wondering whether I could use Clear() in order to remove a fit from a histogram?
On a side note, would that be referred to as TH1::Clear()?