Non responsive SetNdivisions

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)
p = TProfile('profile','',10,0,10)

Originally I tried setting the number of divisions using:


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.

Thanks for your help,


In log scale the number of division is always automatic.

Thank you for your response. Could you recommend a way to gain more control for log axis? Preferably the easiest next to leaving it automatic.



There are only 2 ways:

  • You can change the number of primary division. But it is always optimized and the number you give is always a maximum of decades (try interactively).

  • SetMoreLogLabels

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.

Thanks for your help,


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.

Sorry, I didn’t include the macro:


TProfile* p = new TProfile(“test”,"",10,0,10);




TCanvas* c = new TCanvas(“c”,"",700,500);


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.

This seems like bad behavior, if the axis size is getting smaller (when the bottom margin gets larger) More log labels decides to include more labels?

I agree it does not look logical. I will make a bug report.

I submitted a report:

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.

yes … sorry … I changed the bug report

it is more complex… it depends alos on the window size … :frowning:

I guess that makes sense. Is there a way for a user to see exactly how this is configured?

no … unless you look at the code… it was supposed to be automatic and therefore there no real documentation on that.