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

------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to