|
From: Thomas R. <tho...@gm...> - 2009-04-29 02:52:31
|
Hi,
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()
font.set_size('small')
for tick in ax.get_xticklabels():
tick.set_fontproperties(font)
for tick in ax.get_yticklabels():
tick.set_fontproperties(font)
ax.set_xlabel("Hello")
ax.set_ylabel("World")
fig.canvas.draw()
fig.savefig('test.png')
fig.savefig('test.pdf')
--
Is there a way to ensure that the font sizes are as close as possible
in the files to what is displayed?
Thanks,
Thomas
|