On Fri, Dec 2, 2011 at 4:13 PM, Jonathan Slavin <jsla...@cfa.harvard.edu>wrote:

> Hi all,
>
> I've been trying to use a different serif font for a plot and have been
> running into problems.  I thought I could just do something like:
>
> from matplotlib import rc
> rc('font', family='serif', serif='Times New Roman')
>
> but if I try that I end up getting:
> findfont: Font family ['serif'] not found. Falling back to Bitstream
> Vera Sans
>
> It works fine without the serif='...' part and gives me the default
> serif font.  I know that Times New Roman exists on my system -- at least
> the GNOME character map can find it.  Perhaps I need to use a different
> alias (but what would it be?).  Any help would appreciated.
>
> Jon
>


You should check what fonts are installed on your system:

>>> from matplotlib import font_manager
>>> font_manager.OSXInstalledFonts()

(or if you're on a different system, try MSInstalledFonts or
X11InstalledFonts---those aren't available on my system, but presumably
that's just because I'm using OSX). If that works, then look for Times New
Roman in what's printed out. If it is, the problem may be that it's not the
right format: it appears as
if<http://matplotlib.sourceforge.net/api/font_manager_api.html#module-matplotlib.font_manager>the
font_manager only supports .ttf and .afm fonts.

If you don't see Times New Roman in any of those files, check the output of

>>> mpl.font_manager.OSXFontDirectories

(replacing OSX with MS or X11, if needed). If the listed directories
doesn't match your installation of Times New Roman, that's your problem.
(I'm not sure if there's a good way of adding directories.)

Cheers,
-Tony
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to