看板 Python 關於我們 聯絡資訊
http://tinyurl.com/ydyc8u3s 可以用以下指令查看可以使用的字型 import matplotlib.font_manager matplotlib.font_manager.findSystemFonts(fontpaths=None) 然後用以下指令,進行字型的全域設定 plt.rcParams["font.family"] = "可使用字型名稱" 另外,使用FontProperties,可以透過路徑來選取字型。 import matplotlib.font_manager legend = ax.legend() font = font_manager.FontProperties(fname='C:\\Fonts\\maisfontes-osaka.ttf') for text in legend.texts: text.set_font_properties(font) -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 220.133.32.131 ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1498465656.A.099.html ※ 編輯: ides13 (220.133.32.131), 06/27/2017 13:04:31
dirls: 搞了好久,才發現win10的字型是ttc,matplotlib不認得。 06/29 23:20
dirls: 把副檔名換成ttf後,要把~/.matplotlib 暫存檔刪掉 06/29 23:22
dirls: 新的設定才會生效。 感謝你~~~~ 06/29 23:23