看板 Python 關於我們 聯絡資訊
我的matplotlib版本是 3.5.1 我在畫圖的時候 想把字型設定成 Times new Roman 但是一直有錯誤訊息 findfont: Font family ['Times New Roman'] not found. Falling back to DejaVu Sans. 有人知道要怎麼在matplotlib下去安裝Times New Roman字型嗎? 這問題我google搜尋了一陣子 似乎一直找不到解答 所以才來版上詢問一下版友意見 萬分感謝! -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.117.32.17 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1647332933.A.880.html
karco: plt.rcParams["font.family"] = "Times New Roman" 03/15 16:37
karco: 你是這樣設定嗎? 03/15 16:37
lycantrope: 先移除matplotlib font cache試試看吧 03/15 16:50
lycantrope: import matplotlib as mpl; mpl.get_cachedir() 03/15 16:51
lycantrope: 把找到的cache資料夾刪掉,試看看 03/15 16:52
peter308: 找到解決方法了 03/15 17:08
peter308: import matplotlib.pyplot as plt 03/15 17:08
peter308: plt.rcParams["font.family"] = "serif" 03/15 17:08
peter308: plt.rcParams['font.serif'] = ['Times New Roman'] + p 03/15 17:09
peter308: plt.rcParams['font.serif'] 03/15 17:09
daniel08888: 推分享精神 03/18 20:35