draw_networkx_labels, ax.text ( ax - matplotlib). , , , MPL- (docs).
, ; ,
(, "serif" )
. http://www.w3schools.com/css/css_font.asp
, , , , .
, :
avail_font_names = [f.name for f in matplotlib.font_manager.fontManager.ttflist]
() . , ,
demo .
:
[i for i in matplotlib.font_manager.findSystemFonts(fontpaths=None, fontext='ttf') if 'times' in i.lower()]
avail_font_names ; , .
import matplotlib.pyplot as plt
import networkx as nx
font_names = ['Sawasdee', 'Gentium Book Basic', 'FreeMono', ]
family_names = ['sans-serif', 'serif', 'fantasy', 'monospace']
G = nx.generators.florentine_families_graph()
pos = nx.spring_layout(G)
subgraph_members = [G.nodes()[i:i+3] for i in xrange(0, len(G.nodes()), 3)]
plt.figure(1)
nx.draw_networkx_nodes(G, pos)
for i, nodes in enumerate(subgraph_members):
f = font_names[(i % 3)]
g = G.subgraph(subgraph_members[i])
nx.draw_networkx_labels(g, pos, font_family=f, font_size=40)
nx.draw_networkx_edges(G, pos)
plt.show()

" ..."
: , "UserWarning: findfont: [sans-serif]] . ...", , , nabble : (yup, , .)
rm ~/.matplotlib/fontList.cache