following problem:
a canvas is drawn with an array of 4 TH1F histograms. each histogram is filled with a different nr of values and plottet with LOG scale. To compare the histograms it would be convenient to have in the 4 different y-axis the same nr of bins, meaning to have 5 ticks exactly at 10, 10^2,10^3…
but for some reasons it is not possible.
The code shows one of my tries using GetYaxis()->Set(5,0,1500000.);
Thanks for the reply!
The following macro should represent my problem. 3 TH1F histograms are filled with FillRandom.
What i want to do is to set the nr of bins in y-Axis to a fixed nr (should be the same for every plot)
In the case of the macro i would like to have 4 equal bins ranging from 0. to the maximum value 1000000.
I do not understand your problem. The output of this macro is correct. You set the maximum of the histograms to 10^6 and that is what you get. By definition a 1D histogram does not have bins along the Y axis. So I do not really understand your statement: What i want to do is to set the nr of bins in y-Axis to a fixed nr
what I want to do is to change the nr of “steps” (what i mean with bins) along the y-axis to a nr I choose! (maybe steps=ticks is the right word in english?)
for example:
the maximum of the histogram is 10^6, i want to have “steps” at 10, 10^3, 10^6. This would mean 3 steps along y-axis. In my understanding one can use hist->Set(3,0.,10^6) which should achieve this!?
or for another plot, again with maximum 10^6, i would like to have the following “steps” marked on the y-axis: 10,10^2,10^3,10^4,10^5,10^6 which would mean 6 steps: hist->Set(6,0.,10^6)
Is my understanding of Set() wrong? If yes what would achieve my goals?
I guess you mean the number of decades. The number of decades is largely set in some automatic way but you can change it by setting the number of divisions: