# Problem in fitting (in function!)

**URL:** <https://root-forum.cern.ch/t/problem-in-fitting-in-function/38785>\
**Category:** ROOT\
**Created:** [April 9, 2020, 8:05am UTC](https://root-forum.cern.ch/t/problem-in-fitting-in-function/38785 "2020-04-09T08:05:03Z")\
**Posts on this page:** 1\
**Showing post:** 14

<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:** [April 9, 2020, 6:21pm UTC](https://root-forum.cern.ch/t/problem-in-fitting-in-function/38785/14 "2020-04-09T18:21:35Z")

</div>

@couet There is also another problem that I found. According to the “[How to set ranges on axis?](https://root.cern.ch/how/how-set-ranges-axis)”, one should be able to use [TAxis::SetLimits](https://root.cern/doc/master/classTAxis.html#aa56ec858687dad0b58ca0cf939e7c79b) BEFORE the graph is drawn. This does not work here at all. I needed the following (note: no “pcol” at all so it’s another problem):

```cpp
g->Draw("surf3"); // it MUST be drawn first
gPad->Modified(); gPad->Update(); // one MUST make sure it's really (re)drawn
g->GetXaxis()->SetLimits(50., 200.); // now one can change it
gPad->Modified(); gPad->Update(); // make sure it's really (re)drawn

```

BTW. [TAxis::SetRangeUser](https://root.cern/doc/master/classTAxis.html#ac85f8261dedc23bbe68f90afd196cdb8) also needed canvas “Update” before it could be used (which is not mentioned in the “[How to set ranges on axis?](https://root.cern.ch/how/how-set-ranges-axis)” at all).

---

_[View the full topic](https://root-forum.cern.ch/t/problem-in-fitting-in-function/38785)._
