[爆卦]matplotlib legend中文是什麼?優點缺點精華區懶人包

為什麼這篇matplotlib legend中文鄉民發文收入到精華區:因為在matplotlib legend中文這個討論話題中,有許多相關的文章在討論,這篇最有參考價值!作者ides13 (juso)看板Python標題Re: [問題] win10 matplotlib...



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

你可能也想看看

搜尋相關網站