GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Won't use a font although it can be found by the FontManager · Issue #3590 · matplotlib/matplotlib

Won't use a font although it can be found by the FontManager #3590

New issue
Copy link
New issue
Copy link
Closed
Closed
Won't use a font although it can be found by the FontManager#3590
Copy link
Labels
OS: Microsofttopic: text
Milestone
v1.4.x

Description

@MichaelAdolph
MichaelAdolph
opened on Sep 29, 2014
Issue body actions

Hi,
I was asked to file an Issue here on github, although I'm not sure if the problem is not in front of my PC... .

from pylab import *
from math import sin
rc('text', usetex = False)
la = matplotlib.font_manager.FontManager()
lu = matplotlib.font_manager.FontProperties(family = 'Heuristica')
print la.findfont(lu)
x = np.arange(0,5,0.1)
y = map(sin,x)
title('This is an unnecessary title', family = 'Heuristica')
plot(x,y)
show()

As a result I get (besides a graph using an unwanted font):

C:\Windows\Fonts\Heuristica-Regular.otf
C:\Python27\lib\site-packages\matplotlib\font_manager.py:1279: UserWarning: findfont: Font   family ['Heuristica'] not found. Falling back to Bitstream Vera Sans
(prop.get_family(), self.defaultFamily[fontext]))

If I add Heuristica on first spot of the serif-font-Types this will also not work, (i. e. font.serif : Heuristica, Bitstream Vera Serif)

I am using matplotlib 1.4.0 and Python 2.7.6, I asked this question on StackOverflow first

Activity

  1. tacaswell
    added this to the v1.4.x milestone on Sep 29, 2014
  2. tacaswell
    added
    topic: text
    OS: Microsoft
    on Sep 29, 2014
  3. mdboom commented on Sep 29, 2014

    @mdboom
    mdboom
    on Sep 29, 2014
    Member
    More actions

    When you add new fonts to your system, you need to delete your fontList.cache file in order for matplotlib to find them.

    The reason it works on lines 4/5 in your example is because you are creating a FontManager from scratch (which goes out to the filesystem and hunts down all the fonts). Internally, when matplotlib later does its own font lookup, it is using a FontManager that has been loaded from a cache on disk in the fontList.cache file.

    Long term, we have plans to switch to using the font lookup mechanisms of the OS to get around this problem, (see MEP14), but in the meantime, you'll need to remove the fontList.cache file everytime you want matplotlib to discover new fonts.

    Reacted by Jaehoon Lee and Davide Zanin
  4. mdboom
    closed this as completedon Sep 29, 2014
  5. MichaelAdolph commented on Sep 29, 2014

    @MichaelAdolph
    MichaelAdolph
    on Sep 29, 2014
    Author
    More actions

    Perfect! That trick did it. the fontList.cache is located at Home/.matplotlib

    Reacted by Jaehoon Lee
  6. tacaswell commented on Sep 29, 2014

    @tacaswell
    tacaswell
    on Sep 29, 2014
    Member
    More actions

    Blah, should have known that...

    Reacted by Michael P Schroeder
  7. liuyang1 commented on May 17, 2015

    @liuyang1
    liuyang1
    on May 17, 2015
    More actions

    maybe also /tmp/xdgcache/matplotlib directory in 1.4.2 version

  8. bastelflp commented on Nov 28, 2015

    @bastelflp
    bastelflp
    on Nov 28, 2015
    More actions

    The matplotlib font cache can be found here:
    Win7: %userprofile%\.matplotlib\
    Ubuntu: ~/.cache/matplotlib

    Reacted by Marco Borgeaud, Antoine Jeannot, ashleylid, Michael P Schroeder, Thomas David Baker, [LGAIR] Sejong Yang and Niklas
    Reacted by Filip Drapejkowski
  9. joslloand
    added 2 commits that reference this issue on Jul 15, 2016

    Update soundfield transform figures to illustrate rE

    4f6d2fc

    ATK: Update Intro-to-the-ATK & imaging figures

    604cea3
  10. ashleylid commented on May 25, 2017

    @ashleylid
    ashleylid
    on May 25, 2017
    More actions

    This is closed so apologies for raising it again. This is not working for me, matplotlib version: 1.5.1.

  11. WeatherGod commented on May 25, 2017

    @WeatherGod
    WeatherGod
    on May 25, 2017 via email
    Member
    More actions
    At the least, please try version 1.5.3. It has a lot of fixes that might address your issue. There has also been some more work on font handling for 2.0.x and master.
    …
    On Thu, May 25, 2017 at 9:06 AM, kleinash ***@***.***> wrote: This is closed so apologies for raising it again. This is not working for me, matplotlib version: 1.5.1. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#3590 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AARy-CfZFDCw9PRMxPFTndBMPuzRsiSdks5r9XzigaJpZM4CoQ86> .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS: Microsofttopic: text

    Type

    No type

    Projects

    No projects

      Milestone

      • v1.4.x

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402520 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.