Grid lines on secondary ticks for log-scale graphs

I have a question similar to the question post here:

[url]Setting Grid with with Log Scale

but that post was so old, and the question is actually kind of the opposite so I decided to re-post.

I have tested and confirmed as the post says that the gridlines on secondary ticks will appear ONLY when the log scale has less than 5 decades (actually, it seems to be now when 3 or less full decades are displayed, but that’s a similar condition):

  TCanvas *c1 = new TCanvas;
  TH2I *h1 = new TH2I("h1","grid on secondary ticks",10,1,100,10,1,1000);

  //will see grid lines on secondary ticks

  TCanvas *c2 = new TCanvas;
  TH2I *h2 = new TH2I("h2","no grid on secondary ticks",10,1,10000,10,1,10000);

  //will NOT see grid lines on secondary ticks

Is there a way to get the grid to appear on secondary ticks when you have more decades displayed?

I was a bit confused by the following post:

[url]Grid Lines on Primary and Secondary Tick Divsions

Which clearly states that grid lines are only on primary ticks. It seems the above example is in contradiction to that, but I’ve been ignoring it because that post didn’t deal directly with a log scale. Also, the solution to that post was to make more primary ticks and a) I’m not sure how to do that on log scale, b) If I could do that it seems likely that the tick sizes would be all the same – and that’s something I don’t want.


I found this post:

[url]SetGrid of TCanvas when log axis scale

It seems to suggest that I need to draw the axis lines myself for more than 3 decades displayed. Any further comment on this is appreciated.

Yes you are right.