Pad margin

Is it possible to specify margins of pad by pixel?
I feel it is quite inconvenient if we can set the margin size only in percent of pad height
because the margin is usually for title and labels, thus fixed size is desirable.


kame

This interface would not be device independent. Anyhow it is trivial to convert pixels to pad percentages using
pad->GetWw()
pad->GetWh()

eg
double topmargin = 75./pad->GetWh();
pad->SetTopMargin(topmargin);

Rene

Thank you for the reply.

This means we can specify the margin by pixel only after creating canvas,
which does not ease our trouble with making figures to be inserted in document.
In some cases, I draw only one histogram in a canvas,
and in other cases, expand the height or width of the canvas to draw multiple histograms.
The trouble is that we need to adjust the margin every time we change the size of canvas to obtain comfortable layout.
That is why I hope we can fix the margin in login script (rootlogon.C) or something.


kame

We define the margins by per cent of the pad precisely to keep the aspect ration when you grow/shrink the pad.

Like for all other attribute settings, you can specify your default settings via gStyle, eg
gStyle->SetPadTopMargin(margin)
where margin is computed with the same algorithm described in my previous post.
If you know the default size for your canvas
(eg 600 pixels), you can easily compute margin.

Rene

Actually, I am not happy with keeping the aspect ratio in most of the cases.
I specify font size by pixel to keep it from growing or shrinking as canvas grows or shrinks.
Typically, I do not want the font to get small when canvas is divided.
But, unfortunately, the margin cannot be fixed…


kame

I think we are looping into circles.

You can always specify a font size in pixels.
See doc of TAttText.

Rene

Sorry for my poor English.

I know font size can be specified in pixel.
What I meant is,
for those who specify font size in pixel,
they also want to specify pad margins in pixel
because the margin is usually for histogram labels or titles,
whose size are not changed as the pad is grown or shrinked
if specified in pixel.


kame

Specifying any pad dimension in pixel doesn’t make really sense because this will be valid on the screen output only. That will not work on PS, PDF, SVG etc … outputs. And if you consider the different paper sizes the problem is even worst … what is the pixel size on a A4 paper ? and how large is it on A0 ?