Home | News | Documentation | Download

Y-axis randomly resizes Problem

ROOT Version: v6.18.04
Platform: Ubuntu 20.04 LTS
Compiler: C/C++

Hi, so I am new to root and I am currently using it to extract data from file and plot as well as fit them in each separate canvas, I have the fit in loop however sometimes and randomly the graph that was getting fit resizes on y-axis to x10^256. How would I be able to fix this visual issue? I tried SetNoExponent(kTRUE) but it just removed the axis. I also tried using SetLimits which helped in normal graphing but not in fitting as Y-axis still got inflated. Here is the piece of the loop

...
for(int i=0; i<n; i++){
 
  graph[i]->GetXaxis()->SetLimits(0,3010);
  graph[i]->GetYaxis()->SetLimits(-1,0.07195);
   fit_fn[i]= new TF1(TString::Format("fit_fn_%d", (i+1)), "[0]*exp([1]*-x)+[2]",0,3010);              
   fit_fn[i]->SetParNames("stretch","decay","shift");   
   fit_fn[i]->SetParameters(0,0,0);   
   graph[i]->Fit(fit_fn[i],"B");  
}

I have also attached image for reference:

Thank you all for the help in advance!

Looking at the attached plot, I can clearly see a data point at x=0, y=61e246 so you need to inspect the procedure which creates this graph and fix it there.

Hi,

Thank you for the response I noticed it and use RemovePoint() function to remove the extra points that got generated from the loop; it gets generated after I move from a section of the array to next as it produces points at (0,0). It seems to have removed the problem however I will be here if the problem persists!