I am trying to set the number of divisions for a TProfile plot. A quick example to replicate what I see is this:
c = TCanvas('c1','',700,500)
c.SetLogy()
p = TProfile('profile','',10,0,10)
p.Fill(5.,0.1)
p.Draw()
Originally I tried setting the number of divisions using:
p.GetYaxis().SetNdivisions(...)
When this didn’t work I tried changing the number of divisions using the canvas editor. This too failed. It seems to behave properly with linear scales but not log with a log scale.
The fundamental problem I am having is that when plotting in log scale over a small range the number of divisions is far too small, but SetMoreLogLabels creates too many labels.
I have tried SetMoreLogLabels however this does not optimize very well in my plots all the time. What I mean by “all the time” is that I am trying to automatically generate a large number plots without any interactive tweaking.
Most of the plots come out looking great without any need to play with SetNdivisions or SetMoreLogLabels, but in cases when the y-axis range is small it can happen that there are two few labels. In a subset of these cases SetMoreLogLabels sets too many labels!
I haven’t been able to find clear information of exactly how SetMoreLogLabels is supposed to act.
Yes. “more log label”, is alos kind of automatic …
I am afraid I have no more hints to give you.
Can you produce a smal macro showing what you do not like ? (preferably not in Python)
I’ve attached a macro which shows the problem I have. This may actually deserve a separate thread, because this is some very weird behavior and doesn’t really have to do with SetNdivisions anymore.
In the macro I am changing the style so the bottom margin is slightly bigger. When this is included all of the secondary divisions include a label when I use SetMoreLogLabels. When I comment out this style change or set the bottom margin to something smaller than .145, the number of secondary divisions that include a label is smaller. Is this behavior understood? If it is could it please be explained because I would like not all of the secondary divisions to include a label when SetMoreLogLabels is used.
The More Log label option is entirely automatic and takes the axis size and label size into account to decide which labels should be drawn. You have no control about it. Mays be you can decrease the label size a bit in that particular case.
I may have misunderstood the bug report, but to me it looks like you say that decreasing the canvas margin makes more log labels, when it is actually the other way around. I apologize if this my misunderstanding.