User-defined TF1 plotting only in certain range, not all ranges

Hi All

I am trying to fit a user-defined function on some points using TF1. But by plotting it in certain ranges (I need -150 to -110 but I have tried other range as well), it gives the errors:


Warning in <TCanvas::ResizePad>: Inf/NaN propagated to the pad. Check drawn objects.
Warning in <TCanvas::ResizePad>: c1 height changed from 0 to 10

Warning in <TCanvas::ResizePad>: Inf/NaN propagated to the pad. Check drawn objects.
Warning in <TCanvas::ResizePad>: c1 height changed from 0 to 10

If i change the range to (-150, +101), it plots fine. But even at -150 to 100, it doesn’t plot.

I tried plotting just the TF1 in a different macro, but it gives the same error. For clarity I have attached the macro here. Can someone explain me what’s going on here?

I am using ROOT v6.26.04 on Ubuntu.
customizeHistogram.C (264 Bytes)

Try adding

    f1->SetNpx(99);

before drawing the TF1. The 1-D functions are drawn by default with 100 points in x, and for some reason this doesn’t work for your case (maybe a developer should look at why), but reducing the number of points like above, works here for the range (-150,100); increasing Npx didn’t seem to work in this example at least with several random values I tried.