![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhM4C0Uu3BwPicRDmD80XVyNEF3hkAVmK6Dtu3wIBHLF02do6zpyN-VBjqFHHercqQjN5K4IwnUmO46NrbUAG-BBmVmiMyTS2v3KvrxEELdJ7wysaGfmcLgok493l4fvk7WdgEkMuUbucpZ/s320/Screen+shot+2010-11-17+at+4.44.15+PM.png)
This post is a "note to myself" about fonts and text using matplotlib. It can be hard to remember things like what is a
FontProperties
object and what kind of object is a font_dict
, so here is a little example. It shows how to get (1) the default font with italics, (2) a default font in a particular "family"---sans-serif, (3) and (4) two named fonts and (5) a font loaded from a particular .ttf
file. Notice that in (4) we do not observe the desired response to changing the 'weight'---I'm not sure why yet.The second figure shows a change in the font using
rc
. It looks nice, takes several seconds to draw, and does not give the desired italics. They're all here as a reference. Perhaps they'll be of some use to you as well.![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjVHcGCdh8z5yb-bRsyw_FE1Pb5UvAP9Y9ZilwZzsfi0kURmgW02Z3Uw5zJHL8iYs0c_VpJH78kKg3Aoqgzg9X1WpnW85lajzrQsdZnnuVbObf0fMEs87JpJDx7cCKKJjLqUiHGqdJDEumu/s320/Screen+shot+2010-11-17+at+4.43.45+PM.png)
output: