Hi all,

the following code used to work for me in matplotlib-0.98 to make a
simple scatter plot and change the font from the default font to
Helvetica (I am using mac os x).

import matplotlib
matplotlib.use('PDF')
import matplotlib.pyplot as plt
from matplotlib import rc
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
from scipy import *
from numpy import *

my_fig = plt.figure(figsize=(6,5), dpi=100)
x = rand(100)*300
y = rand(100)
plt.scatter(x, y)
plt.rcParams['xtick.direction'] = 'out'
plt.rcParams['ytick.direction'] = 'out'
c = 0.05*300.5
plt.xlim([0-c, 300+c])
plt.ylim([-0.05, 1.05])
plt.savefig('x.pdf')

i recently upgraded to matplotlib-0.99 and the changing of the font
using the above method no longer works. the figure is plotted the
same, but the font remains the default matplotlib font.

one potential problem in the installation was this: i installed
matplotlib-0.99 using the dmg prepackaged binary installer. this
installed matplotlib in the directory:

/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages

however, for some reason ipython / python2.5 was looking for packages in:

/Library/Python/2.5/site-packages

and so matplotlib/mpl_toolkits was not found. so I copied the
directories 'matplotlib' and 'mpl_toolkits' from
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages
to /Library/Python/2.5/site-packages.  Perhaps this was the cause of
the problem?

thanks for your help.

(i run my code via ipython, by the way.)

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to