Matplotlib setting title bold while using “Times New Roman”

前端 未结 3 681
野的像风
野的像风 2021-01-04 05:48

Originally I can set the figure title to bold by the following:

import Matplotlib.pyplot as plt

plt.title(\"Test\",fontweight=\"bold\")

bu

3条回答
  •  时光取名叫无心
    2021-01-04 06:50

    On linux and mac the bold font of TImes New Roman appears to get choosen over the normal one. That is why you don't see changes setting hte normal one to bold, it already is bold.

    I know the question is very old, but it still is a problem, at least for me on my mac, when you want to use the normal one. I found a very easy solution to this problem, posted by azag0 on github

    del matplotlib.font_manager.weight_dict['roman']
    matplotlib.font_manager._rebuild()
    

    https://github.com/matplotlib/matplotlib/issues/5574

    If you do this, you will see changes when you set fontweight=bold , as the standard one is choosen correctly.

提交回复
热议问题