Matplotlib-Schriftarten in Enthought Canopy
Ich verwende die Matplotlib-Bibliothek in Canopy und die spezifische Funktion ist xkcd (). Diese Funktion verwendet eine bestimmte Schriftart zum Plotten von Diagrammen. Die Schriftart ist Comic Sans MS, die heruntergeladen werden sollte, wenn sie nicht vorhanden ist.
/home/luis/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/font_manager.py:1236: UserWarning: findfont: Font family ['Humor Sans', 'Comic Sans MS'] not found. Falling back to Bitstream Vera Sans (prop.get_family(), self.defaultFamily[fontext]))
Ich benutze das kleine Skript unten, das das Vorhandensein / Fehlen der Schriftart überprüft. Wenn nicht vorhanden, wird es heruntergeladen.
import os
import urllib2
if not os.path.exists('Humor-Sans.ttf'):
fhandle = urllib2.urlopen('http://antiyawn.com/uploads/Humor-Sans-1.0.ttf')
open('Humor-Sans.ttf', 'wb').write(fhandle.read())
Das Problem ist, dass ich immer noch nicht die richtige Schrift zur Anzeige bekomme. Falls es ein Problem mit dem Font-Cache gibt, mache ich Folgendes:
luis@luis-VirtualBox:~$ rm /home/luis/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/fontList.cache
Folgendes erhalten:
rm: cannot remove ‘/home/luis/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/fontList.cache’: No such file or directory
Was vermisse ich?