Draw with part-linear and part-log y scale


For many distributions of number of events, having part of it plotted in linear scale (top part, high-stat; bulk) and part in log scale (bottom part; low-stat; tails) may be useful in assessing agreement without the need to have separate lin and log plots.

Before going about doing this the wrong way (I thought of drawing things twice with overlapping pads in a canvas, which is a pretty ugly solution,) I was hoping that ROOT experts could lay out a roadmap on how this could be done in a more elegant and re-usable way.



The only way to do it, is to have two pads on top of each other.
One in log scale and one in linear scale.

Thanks Olivier. Seems like my naive solution is not that stupid.



So far, so good: c1.pdf (23.9 KB) is changing at y=20.

I know how to scale some of the things to match the 2 pads (like the y axes fonts) but I could use a hand at figuring out:

  • how to disable the top (bottom) ticks and axis line on the bottom (top) pad,
  • how to avoid that the y axis label “20” does not get eaten away and
  • a smart way to space y ticks in the smaller (bottom) pad

Any ideas welcome,


The attached macro. may help you.
BrokenAxis.C (1.35 KB)