Labels dropping off using CanvasPartition

Dear ROOTers,

I’m having issues using the function CanvasPartition here:

I’m uploading the picture, but I can’t upload it directly because this forum doesn’t allow eps format, and the problem does not occur in png. (5.5 KB)

The first label of the second and third pad are dropping off.

Is there anything I can do about this? It’d be fine if I could just remove the 0 labels from the second and third pad.


The latest version of this macro is here:
It works as expected as you can see on the picture (which is generated every night using ROOT master).

Hi couet,

The macro only works in those cases because there is no label attached to the very left of every x-axis. My plots start from zero, which is when the issue occurs. I replaced the macro with the new one you linked to, but it made no difference.

I’m afraid there is no automatic solution.
You will need to manually change the x-axis minimum (or your histogram x-axis minimum) and then the number which is truncated will also be moved in the picture (so it will either entirely disappear or it will become entirely visible).

BTW. People usually meet this problem with the y-axis:

The first label is cut off because it is clipped on the Pad edge. In the new TRatioPlot class we solved this issue by removing the labels on edges using the new method ChangeLabel .

The following macro is a modified version of canvas2.C doing this trick.

canvas3.C (5.1 KB)

Note that ChangeLabel can do mush more than simply removing a Label.

Thanks couet and Wile_E_Coyote,

I managed to remove the 0 by settings the start of the histogram to 0.001, but I’ll look into the macro as well.

Note that if you want to keep the 0 you can also change the label alignment instead of removing it:

         hFrame->GetXaxis()->ChangeLabel(1,-1,-1.,11.); // the first label is left aligned
         hFrame->GetXaxis()->ChangeLabel(-1,-1,0.); // remove the last label

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.