# Starting gragh from zero at x-axis

**URL:** <https://root-forum.cern.ch/t/starting-gragh-from-zero-at-x-axis/48405>\
**Category:** ROOT\
**Created:** [January 16, 2022, 6:46am UTC](https://root-forum.cern.ch/t/starting-gragh-from-zero-at-x-axis/48405 "2022-01-16T06:46:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tahany](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/t/c6cbf5/32.png) [@Tahany](https://root-forum.cern.ch/u/Tahany)\
**Post date:** [January 16, 2022, 6:46am UTC](https://root-forum.cern.ch/t/starting-gragh-from-zero-at-x-axis/48405/1 "2022-01-16T06:46:12Z")

</div>

hi,

I am making a comparison between two graphs in the same canvas with time on the x-axis but found the x-axis has been shifted and not started from zero! I am not sure why does it happen and how to adjust it to start from 0??

[mg.pdf](https://root-forum.cern.ch/uploads/short-url/rDZ2onfcOTrH7IpTIOMwYD08LLQ.pdf) (19.3 KB)

Thanks a lot,

---

<div class="post-metadata">

**Author:** ![dastudillo](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dastudillo/32/17280_2.png) [@dastudillo](https://root-forum.cern.ch/u/dastudillo)\
**Post date:** [January 16, 2022, 7:46am UTC](https://root-forum.cern.ch/t/starting-gragh-from-zero-at-x-axis/48405/2 "2022-01-16T07:46:44Z")

</div>

> [@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…

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [January 30, 2022, 7:47am UTC](https://root-forum.cern.ch/t/starting-gragh-from-zero-at-x-axis/48405/3 "2022-01-30T07:47:27Z")

</div>

Closed on January 30, 2022, 7:47am UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
