Hi all,

I'm using the PDF backend and I'm mucking around with the figure width and height settings to try and get the label text size equal to that of the tex in a LaTeX report I'm writing. The following code set my dimensions:

FACTOR = 1.0

fig_width_pt = 483.69687 * FACTOR # figure width in pt as returned by \showthe in LaTeX multiplied by a factor

inches_per_pt = 1.0/72.27

golden_ratio = (np.sqrt(5) - 1.0) / 2.0

fig_width_in = fig_width_pt * inches_per_pt

fig_height_in = fig_width_in * golden_ratio

fig_dims = [fig_width_in, fig_height_in]

matplotlib.use('PDF')

matplotlib.rc('font',**{'family':'serif','serif':['Computer Modern Roman']})

matplotlib.rc('text', usetex=True)

matplotlib.rc('axes', labelsize=8)

matplotlib.rc('legend', fontsize=8)

matplotlib.rc('xtick', labelsize=8)

matplotlib.rc('ytick', labelsize=8)

matplotlib.rc('font', size=8)

matplotlib.rc('figure', figsize=fig_dims)

I then plot my data, all is fine until I realised that the saved PDF uses a generous amount of whitespace around the edge of the figure. I get rid of the whitespace by calling savefig with a few extra arguments:

fig2.savefig('errors.pdf', bbox_inches='tight', pad_inches=0.03)

For about 18 months now I've been under the illusion that this produces a figure whose labels are actually size 8 text. This is not the case (after import into LaTeX) since the axing of the whitespace has been done in such a way that the figure does not take up the available space. The figure is actually cropped. So when it's imported into LaTeX the figure is actually blown up (slightly) due to the cropping.

Is there another way around this that will get rid of the whitespace and have the physical figure be 483.69687pt wide?

Any help would be greatly appreciated.

Regards,

-- Damon

## ···

--------------------------

Damon McDougall

Mathematics Institute

University of Warwick

Coventry

CV4 7AL

d.mcdougall@...831...