Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change font to Helvetica (Neue) in Linux #2778

Closed
gozzilli opened this issue Jan 31, 2014 · 3 comments
Closed

Change font to Helvetica (Neue) in Linux #2778

gozzilli opened this issue Jan 31, 2014 · 3 comments
Milestone

Comments

@gozzilli
Copy link

I'm unable to use the fonts Helvetica and Helvetica Neue in Ubuntu Linux.
I receive the error:

/usr/local/lib/python2.7/dist-packages/matplotlib-1.3.0-py2.7-linux-x86_64.egg/matplotlib/font_manager.py:1236: 
UserWarning: findfont: Font family ['Helvetica Neue'] not found. Falling back to Bitstream Vera Sans

Note that:

  1. I removed the font cache (but it never got regenerated. Could that be the problem?)
  2. The same font on MacOS works fine with matplotlib.
  3. I'm happy to attach the font if necessary (and if it's allowed)

matplotlib version: 1.3.0 and master (1.4.x)
ubuntu version: 13.04

I reported the steps I went through for troubleshooting on stackoverflow:
http://stackoverflow.com/questions/21461155/

In short:

import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.font_manager as font_manager

path = '/home/<myusername>/.fonts/HelveticaNeue.ttf'

prop = font_manager.FontProperties(fname=path)
prop.set_weight = 'light'
mpl.rcParams['font.family'] = prop.get_name()
mpl.rcParams['font.weight'] = 'light'

fig, ax = plt.subplots()
ax.set_title('Text in a cool font', fontproperties=prop, size=40)
plt.savefig('/tmp/test2.png')
@tacaswell tacaswell added the text label Feb 26, 2014
@tacaswell tacaswell added this to the v1.4.x milestone Jul 12, 2014
@tacaswell
Copy link
Member

@gozzilli Closing this as it has had no traffic in a year.

I suspect that the issue is related to needing to re-build your font cache.

Does this issue persist on the current release?

Ping to have this re-opened if you can still reproduce this issue.

@gozzilli
Copy link
Author

@tacaswell Does the font cache matter when you are specifying a font's path directly?
Anyway, the problem does not persist on current release, so all good. Thanks!

@tacaswell
Copy link
Member

Clearing the cache never hurts!

On Tue Feb 10 2015 at 10:25:32 AM Davide notifications@github.com wrote:

@tacaswell https://github.com/tacaswell Does the font cache matter when
you are specifying a font's path directly?
Anyway, the problem does not persist on current release, so all good.
Thanks!


Reply to this email directly or view it on GitHub
#2778 (comment)
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants