# Y-axis randomly resizes Problem

**URL:** <https://root-forum.cern.ch/t/y-axis-randomly-resizes-problem/40021>\
**Category:** Newbie\
**Created:** [June 22, 2020, 2:53am UTC](https://root-forum.cern.ch/t/y-axis-randomly-resizes-problem/40021 "2020-06-22T02:53:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abhinab\_Mukhopadhyay](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/abhinab_mukhopadhyay/32/20444_2.png) [@Abhinab\_Mukhopadhyay](https://root-forum.cern.ch/u/Abhinab_Mukhopadhyay)\
**Post date:** [June 22, 2020, 2:53am UTC](https://root-forum.cern.ch/t/y-axis-randomly-resizes-problem/40021/1 "2020-06-22T02:53:10Z")

</div>

_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

```auto
...
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:

 ![Capture4](https://root-forum.cern.ch/uploads/default/original/3X/b/8/b88b77f52820f3014b3b26914d492d46221dbd45.png)

Thank you all for the help in advance!

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [June 22, 2020, 5:57am UTC](https://root-forum.cern.ch/t/y-axis-randomly-resizes-problem/40021/2 "2020-06-22T05:57:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Abhinab\_Mukhopadhyay](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/abhinab_mukhopadhyay/32/20444_2.png) [@Abhinab\_Mukhopadhyay](https://root-forum.cern.ch/u/Abhinab_Mukhopadhyay)\
**Post date:** [June 22, 2020, 6:25pm UTC](https://root-forum.cern.ch/t/y-axis-randomly-resizes-problem/40021/3 "2020-06-22T18:25:40Z")

</div>

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!
