Skip to content

Unify axis titles and label sizing and offsetting across a set of pads #20484

@will-cern

Description

@will-cern

Explain what you would like to see improved and how.

Hello,

I am opening this issue to discuss and come up with a solution for a long-standing but purely cosmetic frustration with ROOT: getting axis titles and label sizes and offsettings consistent between pads.

It is very common to create a canvas with a couple of pads in it to display a main plot and an auxiliary plot. But the default behaviour currently means the sizing and offsetting is determined per pad.

Here's the reproducer:

TH1D h("h",";xaxis title;yaxis title",10,0,1); 
h.Draw(); 
gPad->SetBottomMargin(0.3); 
auto auxPad = new TPad("auxPad","",0,0,1,0.3); 
auxPad->Draw(); 
auxPad->cd(); 
h.Draw();
Image

Playing with the size and offset settings on a case-by-case basis can get you what you want, but there really should be a way for this to work with the default settings (relative sizing and automatic offsetting).

I think somehow we need to be able to tell the TGAxis which pad to use for its sizings, rather than always using the gPad. Is that the way this could be ultimately solved?

I didn't want to spend time on a possible solution until this was discussed with others (I assume @couet in particular?)

Cheers
Will

ROOT version

all

Installation method

any

Operating system

any

Additional context

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions