# TGraph SetLimits

**URL:** <https://root-forum.cern.ch/t/tgraph-setlimits/33144>\
**Category:** ROOT\
**Tags:** python, root\
**Created:** [March 13, 2019, 4:34pm UTC](https://root-forum.cern.ch/t/tgraph-setlimits/33144 "2019-03-13T16:34:23Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [March 14, 2019, 8:23am UTC](https://root-forum.cern.ch/t/tgraph-setlimits/33144/3 "2019-03-14T08:23:08Z")

</div>

There is an HowTo about his:

> [@How to set ranges on axis?](https://root-forum.cern.ch/t/how-to-set-ranges-on-axis/28254):
>
> The viewing range for a histogram axis can be set from bin ifirst to ilast using the method TAxis::SetRange(ifirst, ilast). Example (hpxpy is a 2D histogram): { TFile f("hsimple.root"); hpxpy-\>Draw("colz"); hpxpy-\>GetYaxis()-\>SetRange(22,23); hpxpy-\>GetXaxis()-\>SetRange(18,19); } Sometimes it is more convenient to set this range using “User’s Coordinates” (axis values) rather than bin numbers. To do that one should use TAxis::SetRangeUser(ufirst, ulast). This method computes the cl…

---

_[View the full topic](https://root-forum.cern.ch/t/tgraph-setlimits/33144)._
