-
取得字體 (e.g.
Droid-Sans-Fallback.ttf
) 放到<venv>/lib/python3.8/site-packages/matplotlib/mpl-data/fonts/ttf/
-
編輯
<venv>/lib/python3.8/site-packages/matplotlib/mpl-data/matplotlibrc:257
反註解兩行,把字體名稱加上去,注意到
Droid-Sans-Fallback
的-
要用- #font.family: sans-serif + font.family: sans-serif #font.style: normal #font.variant: normal #font.weight: normal #font.stretch: normal #font.size: 10.0 #font.serif: DejaVu Serif, Bitstream Vera Serif, Computer Modern Roman, New Century Schoolbook, Century Schoolbook L, Utopia, ITC Bookman, Bookman, Nimbus Roman No9 L, Times New Roman, Times, Palatino, Charter, serif - #font.sans-serif: DejaVu Sans, Bitstream Vera Sans, Computer Modern Sans Serif, Lucida Grande, Verdana, Geneva, Lucid, Arial, Helvetica, Avant Garde, sans-serif + font.sans-serif: Droid Sans Fallback, DejaVu Sans, Bitstream Vera Sans, Computer Modern Sans Serif, Lucida Grande, Verdana, Geneva, Lucid, Arial, Helvetica, Avant Garde, sans-serif #font.cursive: Apple Chancery, Textile, Zapf Chancery, Sand, Script MT, Felipa, Comic Neue, Comic Sans MS, cursive #font.fantasy: Chicago, Charcoal, Impact, Western, Humor Sans, xkcd, fantasy #font.monospace: DejaVu Sans Mono, Bitstream Vera Sans Mono, Computer Modern Typewriter, Andale Mono, Nimbus Mono L, Courier New, Courier, Fixed, Terminal, monospace
-
刪除
~/.cache/matplotlib/
Last active
December 6, 2023 03:54
-
-
Save zhowzeng/c064e8bf702f86c6ba62c5428286c6c5 to your computer and use it in GitHub Desktop.
修理 matplotlib 中文顯示錯誤
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment