I am using the savefig method to save plots - however, I am finding that the font size is systematically larger in the saved images than in the WxAgg window. It seems that text is ~30% larger in PNG and PDF files compared to the WxAgg display (relative to the axes box size). This can be a little frustrating, as in some cases it can lead to label overlap in the PNG file, when the displayed version looked fine. The following script produces a PNG and a PDF file in which the font size is ~30% larger than in the WxAgg display.
from matplotlib.font_manager import FontProperties
import matplotlib.pyplot as mpl
fig = mpl.figure()
ax = fig.add_subplot(111)
font = FontProperties()
for tick in ax.get_xticklabels():
for tick in ax.get_yticklabels():
Is there a way to ensure that the font sizes are as close as possible in the files to what is displayed?