Home | News | Documentation | Download

Changing my x axis to radians

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

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

to change the histogram binning, you can use the TH1::SetBins method.

To keep the histogram binning but change the range that is displayed, you can use TAxis::SetRangeUser (e.g. as th1d.GetXaxis()->SetRangeUser(...)).


I you are talking about changing the axis labels to [ -Pi , Pi] the way to proceed is explained here.