# Set User range on TGraph not working for x-axis , but OK for y-axis

**URL:** <https://root-forum.cern.ch/t/set-user-range-on-tgraph-not-working-for-x-axis-but-ok-for-y-axis/60668>\
**Category:** Newbie\
**Created:** [September 1, 2024, 9:17pm UTC](https://root-forum.cern.ch/t/set-user-range-on-tgraph-not-working-for-x-axis-but-ok-for-y-axis/60668 "2024-09-01T21:17:12Z")\
**Posts on this page:** 1\
**Showing post:** 11

<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:** [September 5, 2024, 3:47pm UTC](https://root-forum.cern.ch/t/set-user-range-on-tgraph-not-working-for-x-axis-but-ok-for-y-axis/60668/11 "2024-09-05T15:47:07Z")

</div>

> [@Problem in setting the range of the plot](https://root-forum.cern.ch/t/problem-in-setting-the-range-of-the-plot/50089/10):
>
> Actually, for “graphs”, it is very easy to use any “arbitrary values” for the x-axis range: graph-\>GetHistogram()-\>GetXaxis()-\>SetLimits(xmin, xmax);

> [@Set first axis number to draw](https://root-forum.cern.ch/t/set-first-axis-number-to-draw/50912/6):
>
> Try: mg\_comp\_Stz\_Q2-\>Draw("ALP"); gPad-\>Modified(); gPad-\>Update(); mg\_comp\_Stz\_Q2-\>GetHistogram()-\>GetXaxis()-\>SetLimits(0.5, 69.5); // or maybe (1., 70.) gPad-\>Modified(); gPad-\>Update();

---

_[View the full topic](https://root-forum.cern.ch/t/set-user-range-on-tgraph-not-working-for-x-axis-but-ok-for-y-axis/60668)._
