This figure illustrates the plot layout, starting with PHPlot-5.0.5 when the margin calculations were rewritten. Use the following notes to help understand the figure.
The safe_margin (box with X) is a gap of 5 pixels used to separate elements.
The main title, X titles, and Y titles are optional. If these titles are not set, the space allocated to them collapses, including the safe_margin gap. This is shown in the figure with an arrow.
Similarly, the X tick labels, X data labels, and Y tick labels are optional. If these labels are not used, the space allocated to them collapses, including the safe_margin.
X data labels and X tick labels occupy the same space. Normally only one of these should be present; if both are on for some reason they will overlay.
There is a minimum value for top, left, right, and bottom margins. The minimum is currently fixed at 3 times the safe_margin. Even if there are no titles at all on a side, the margin on that side will be no less than the minimum margin. This keeps the axis or plot area edge from coming too close to the image edge.
The main title is positioned relative to the top of the image. Starting with PHPlot-5.0.5, the X and Y titles are positioned relative to the plot area. PHPlot-5.0.4 and earlier positioned the X and Y titles relative to the image edges. The difference should not be visible with automatic margins, but if the margins are set larger, or the plot area smaller, then the X and Y titles will move inwards with the newer releases.
It is possible to position X ticks and X tick labels to 'xaxis', and Y ticks and Y tick labels to 'yaxis', so the ticks and/or labels will float to the axis positions rather than always appear on the edges of the plot area. Space will be allocated for the corresponding margin only if the axis happens to fall exactly at the data limits for that side. This may cause problems if the axis is close but not quite at the edge; no margin space will be allocated on that side for the labels, and the labels may overlap the title or fall off the edge of the image.