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.output: