How to load .ttf file in matplotlib using mpl.rcParams?

后端 未结 3 1116
逝去的感伤
逝去的感伤 2020-12-01 15:10

I have a matplotlib script that starts ...

import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.font_manager as fm

mpl.rcParams[\'xt         


        
3条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-01 15:26

    You can use the fc-query myfile.ttf command to check the metadata information of a font according to the Linux font system (fontconfig). It should print you names matplotlib will accept. However the matplotlib fontconfig integration is rather partial right now, so I'm afraid it's quite possible you'll hit bugs and limitations that do not exist for the same fonts in other Linux applications.

    (this sad state is hidden by all the hardcoded font names in matplotlib's default config, as soon as you start trying to change them you're in dangerous land)

提交回复
热议问题