Extending Canvas When Object Is Outside Boundaries, and X-Axis Covering Box

Thanks once again.
I found the following solution to the box problem:
By resizing the top and right margins (using for example “myPad.SetTopMargin(0.3)”) one can move the axes away from their respective sides of the picture.
With the right margin values, the green/grey box’s top right corner will meet the top right corner of the whole picture.
If the box is very wide or tall, the canvas size can be changed to accommodate the new aspect ratio.

Edit: Both of the problems discussed in this thread are now completely solved, and their answers are documented in this thread.
Solutions:
Box overlapping axis
Including box in picture, but outside graph