Decreasing blank image space?

Hello, I have generated an image with savefig(...,

    > dpi=100). I do not use a main title for the graph (not the
    > same as the X- and Y- axis labels). When I display the
    > image on an HTML page, there is a space of approximately 60
    > pixels above the image that contain no graph drawing, I
    > assume this space was reserved for a title that I have no
    > need for. The white space of 60 pixels on top creates too
    > much gap between the image and another HTML page element
    > above.

Hi Brian,

The Axes is the white space that contains the lines, rectangles, text
etc. The Figure is the whole canvas that contains the Axes. The
default Axes is created by Subplot(111) which leaves empty space at
the left, bottom, top, right and bottom. You can create your own Axes
dimensions. with the "axes" command

   http://matplotlib.sf.net/matplotlib.pylab.html#-axes

Eg, to leave no room at right or top, use

  ax = axes([0.1, 0.1, 0.9, 0.9])

The arguments to the axes function are left, bottom, width and height,
expressed as fractions of the figure width and height. 0,0 is bottom,
left and 1,1 is top, right. So the lower left corner of this axes is
0.1, 0.1 and the upper right is 0.1+0.9, 0.1+0.9 or 1,1 which is the
upper right of the figure (no white space).

You may also want to customize the background color of the Axes and
Figure to be the same -- see help for axes, figure and savefig (hint,
although the figure has a background color, savefig overrides it
because sometimes you want a different figure background when working
interactively and saving).

See also examples/axes_demo.py.

JDH