# Set View Window on X-Axis

**URL:** <https://root-forum.cern.ch/t/set-view-window-on-x-axis/35170>\
**Category:** Newbie\
**Created:** [July 12, 2019, 8:32pm UTC](https://root-forum.cern.ch/t/set-view-window-on-x-axis/35170 "2019-07-12T20:32:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ethan\_Nguyen](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/e/bc8723/32.png) [@Ethan\_Nguyen](https://root-forum.cern.ch/u/Ethan_Nguyen)\
**Post date:** [July 12, 2019, 8:32pm UTC](https://root-forum.cern.ch/t/set-view-window-on-x-axis/35170/1 "2019-07-12T20:32:46Z")

</div>

I’m creating a graph from a file, but I can’t set the range on the x-axis. How can I set the range for the x-axis?

Thanks!

```auto
{
  g = new TGraph("Sample72.txt");
  g->SetTitle(" PWO Sample 72 - Transverse Optical Transmittance; Position (mm); Optical Transmittance (%);");
  g->SetMinimum(0);
  g->SetMaximum(100);
  g->Draw("ALP");
}

```

---

<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:** [July 12, 2019, 8:34pm UTC](https://root-forum.cern.ch/t/set-view-window-on-x-axis/35170/2 "2019-07-12T20:34:55Z")

</div>

`g->GetXaxis()->SetLimits(xmin, xmax);`
