Axis rescale and configuration

Dear experts,

I am having trouble in the configuration of my axis. I want to do three main adjustments.:

The first one, is that i don’t want to plot the first and last limits of the y axis [0 : 35e3].

The second and the third is kinda of similar, in the y axis i want instead of 35.000 print 35 and then have a 10e3 scale, and print the scale, in right top of the graph if possible.

And the last one is on x axis, my data is in MeV but i want plot it in GeV, so i wonder is is possible or i need to change my data directly?.

Thanks a lot in advance.

For 1 and 2, search on the Forum or Documentation for:
1 - SetMaximum / SetMinimum ( histo->SetMaximum(mymax); )
2 - SetMaxDigits.

For 3, you have to do the conversion yourself.

1 Like

In my problem number 2, i should write: histogram.GetYaxis().SetMaxDigits(2) right ? And so it should appear 35 x 10 e3 instead of 35000? The problem is that i have more than one histogram in my plot, i used GetYaxis().SetMaxDigits(2) in all of them, but the digits in the Y axis remained the same. It should have worked as i did or there is something different when dealing with more than one histogram?.

Thanks for the attention once more.

You can try to change a bit the min and max of the histogram. The label optimisation will very likely drop the fist and last labels. May be post an example macro so we can show on a real example.

1 Like

It worked @couet , thank you!

I was finally able to do it, thank you @dastudillo for the solution.

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