Multiple fit displayed

Hi all,

I have to fit a TGraph in 2 different rages, using 2 different functions.
The problem is that only the 2nd fit function is drawed on the canvas, but not the 1st one.
Can some one give me a suggestion?

Thanks in advance :slight_smile:

Try using the โ€œ+โ€ option when fitting the second, third, etc. functions, e.g.:


Thanks fot the sugestion, but unfortunately it doesnโ€™t works.
It keeps displayed the first fit, but the second one is not drawed.

Is the first one drawn at all, when you donโ€™t draw the second? In any case, it will be helpful if you show the relevant part of your code, or similar code showing the issue.

Hi @booghimen,
actually there is no option like same for the fit.
You can check the TGraph::Fit method page.

What you can do, is to avoid to draw the two function during the fitting process using the 0 option of the Fit method, and then draw the two function with the standard draw of the TF1 class.
Have a look a the few lines of code I wrote below.

TF1 *f = new TF1("f","your first function",xmin,xmax);
TF1 *f2 = new TF1("f2","your second function",xmin2,xmax2);




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