Hello,

I am trying to plot the pseudo-data minus the fit for a 5-parameter function. I have done this before with actual data, but for some reason, this time I am not getting a graph that shows the difference on the same canvas. I get the following warnings:

`Warning in <TPad::ResizePad>: Inf/NaN propagated to the pad. Check drawn objects.`

`Warning in <TPad::ResizePad>: Comp_2 height changed from 0 to 10`

I am very confused and any help would be greatly appreciated.

para_five_difference.cxx (2.5 KB)

_ROOT Version: 6.23/01

Hi

at line 53 you do a fit

```
histo->Fit(parabola_5,"M","SAMES",2.e-1,1);
```

from line 61 on you set params again:

```
parabola_5->SetParameter(0,10);
parabola_5->SetParameter(1,2.6);
```

so your fitted params are lost

Otto

Thank you, it worked. Do you know how I could make it so that the axes are log-scaled?

```
gPad->SetLogy(1)
```

for details see:

https://root.cern/doc/master/classTPad.html#a148366f3d7b780d821b56e4ed35d47ea

Otto

Thank you again. Sorry to bother you again, but when I try to divide by the Bin error (line 81), I get the same problem as before. para_five_difference.cxx (2.5 KB)

HI,

your DiffHist (as it was before) represents the residuals

(bin_content - fitted_value).

Why do you divide the fitted_value by the bin_error?

In this way you cannot expect something centered around 0

Otto

in my last answer I overlooked one of your many “((((()))))”

real problem is that the bin_error can be 0 giving devide by 0 -> NaN

You must check for that.

Thank you again! I just added an if statement in the for loop, and it seems to work.

para_five_difference.cxx (2.5 KB)