https://wiki.ubuntulinux.jp/UbuntuTips/Desktop/InstallFont#A.2BYktS1TBnMKQw8zC5MMgw.2FDDrMFkwiw-
List fonts
fc-list|less
Check if there is a font you want to use
Example: Whether there is a font containing Takao
fc-list|less | grep Takao
https://github.com/blagarde/midori/blob/master/fonts-japanese-gothic.ttf https://github.com/marcan/blitzloop/blob/master/TakaoPGothic.ttf <-Since this is gone, I tried the following (2017/10/07)
https://github.com/byrongibson/fonts/blob/master/backup/truetype.original/takao-gothic/TakaoPGothic.ttf
Download these two this time
Copy the following to / usr / local / share / fonts /
on the directory where the above two are placed
cp *ttf /usr/local/share/fonts/
Check the location of the configuration file below
>>> import matplotlib
>>> matplotlib.matplotlib_fname()
'/home/foo/.config/matplotlib/matplotlibrc'
Just write the following in ~ / .config / matplotlib / matplotlibrc
,
font.family: (The font you want to use)
This time,
font.family: TakaoPGothic
And said.
Lastly, the important thing that was the article of Drawing Japanese with matplotlib on Ubuntu!
Delete Font cache
rm ~/.cache/matplotlib/fontList.cache
The file name may be different, so find the file with fontList under ~ / .cache / matplotlib /
and delete it.
Recommended Posts