How to change range Y-axis

I don’t think so because I’m setting the step of 3

It doesn’t mean anything to me, but anyway, if the proposed solution gives you what you’re looking for, just go ahead!

1 Like

Thank you so much. the solution will confirm when comparing with the experimental results, we hope that will be the case. and thanks again for your help

1 Like

You’re very welcome!

1 Like

hello, here I have plotted the same data file with Histogram and TProfile, and as you see there is a clear difference between the two !!!


TH1 does frequency count for x variable, and if the x are the same when you do Fill(x, y), it will be filled to the same bin, adding y to what’s existing in the bin content. So say you fill with to a bin with x from -1 to 1, Fill(0, 1), the bin content will be changed from 0 to 1. And if you fill another line in your file (0, 3), the bin content will change from 1 to 4… TProfile takes the average weight in each bins, the number of entries to divide is just how many time you fill that bin. So in my simple example up there, it will be 2. I didn’t say the two utility give the same result when their maximum is set to be the same, I’m simply guessing what you want to do. Now that you have an example plot there, are you missing a third axis information for the 6 MeV, 9 MeV…? That is maybe energy of incoming particle…?

It’s not possible to help you solve the problem because you still didn’t describe what’s in your data format, what do they mean and what exactly do you want to plot with it. In this case, we can only tell you the ROOT behavior. Please think about the problem again and describes clearly so that we can continue to help.

For more root class, you can also refer to:

Perhaps you could hand-write a simpler txt file with an expectation of what the plot will look like, to understand the mechanism of ROOT.


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