# Changing my x axis to radians

**URL:** <https://root-forum.cern.ch/t/changing-my-x-axis-to-radians/40638>\
**Category:** Newbie\
**Created:** [July 26, 2020, 3:18am UTC](https://root-forum.cern.ch/t/changing-my-x-axis-to-radians/40638 "2020-07-26T03:18:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![IP25](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ip25/32/22277_2.png) [@IP25](https://root-forum.cern.ch/u/IP25)\
**Post date:** [July 26, 2020, 3:18am UTC](https://root-forum.cern.ch/t/changing-my-x-axis-to-radians/40638/1 "2020-07-26T03:18:46Z")

</div>

I am trying to plot the direction of particles in a th1d. How can I change the X axis to be from -pi to pi?

_ROOT Version:_  
_Platform:_ Jupyter  
_Compiler:_ Jupyter -6.18

* * *

---

<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:** [July 26, 2020, 4:34am UTC](https://root-forum.cern.ch/t/changing-my-x-axis-to-radians/40638/2 "2020-07-26T04:34:19Z")

</div>

Create your histogram from -pi to pi or maybe -4 to 4, unless you have data going outside that range.

---

<div class="post-metadata">

**Author:** ![eguiraud](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/eguiraud/32/32217_2.png) [@eguiraud](https://root-forum.cern.ch/u/eguiraud)\
**Post date:** [July 27, 2020, 9:04am UTC](https://root-forum.cern.ch/t/changing-my-x-axis-to-radians/40638/3 "2020-07-27T09:04:46Z")

</div>

Hi,  
to change the histogram binning, you can use the [TH1::SetBins](https://root.cern.ch/doc/master/group __tutorial__ graphs.html) method.

To keep the histogram binning but change the range that is displayed, you can use [TAxis::SetRangeUser](https://root.cern.ch/doc/master/classTAxis.html#ac85f8261dedc23bbe68f90afd196cdb8) (e.g. as `th1d.GetXaxis()->SetRangeUser(...)`).

Cheers,  
Enrico

---

<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:** [July 27, 2020, 9:11am UTC](https://root-forum.cern.ch/t/changing-my-x-axis-to-radians/40638/4 "2020-07-27T09:11:12Z")

</div>

I you are talking about changing the axis labels to [-Pi , Pi] the way to proceed is explained [here](https://root.cern/doc/master/classTGaxis.html#GA10a).
