Menu

[r7969]: / branches / mathtex / examples / api / font_file.py  Maximize  Restore  History

Download this file

20 lines (15 with data), 564 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# -*- noplot -*-
"""
Although it is usually not a good idea to explicitly point to a single
ttf file for a font instance, you can do so using the
font_manager.FontProperties fname argument (for a more flexible
solution, see the font_fmaily_rc.py and fonts_demo.py examples).
"""
import matplotlib.font_manager as fm
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot([1,2,3])
prop = fm.FontProperties(fname='/Library/Fonts/Tahoma.ttf')
ax.set_title('this is a special font', fontproperties=prop)
plt.show()
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.