When I tried to display Japanese in the graph, the characters became garbled and I was quite addicted to it, so as a memorandum.
When using a virtual environment with Anaconda, it will be reset to "Every environment".
Characters are garbled with the display of missing from current font.
The font used to eliminate garbled characters may be MS Gothic
, but it seems that the license-free font ʻIPAex Gothic, which can also be used on Linux, is often used. In some past reference articles, past fonts such as ʻIPAP Gothic
were used, so I was addicted to writing with reference to that.
It can be obtained from the IPA site. In 2020 Oct, ʻIPAex font v4.0.1` seems to be the latest. Follow the procedures such as terms of use to download and unzip.
Copy ttf file to the following folder
C: \ Users \ [your account] \ Anaconda3 \ envs \ [virtual environment name you want to use] \ Lib \ site-packages \ matplotlib \ mpl-data \ fonts \ ttf
Open the matplotlibrc file
in the following folder with Notepad etc.
C: \ Users \ [your account] \ Anaconda3 \ envs \ [virtual environment name you want to use] \ Lib \ site-packages \ matplotlib \ mpl-data
Around line 250
to # font.family :. (It seems that the default
sans-serif` can be deleted.) Also, change the name as appropriate depending on the font used.fontlist-vXXX.json
in C: \ Users \ [your account] \ .matplotlib
to the Trashmatplotlibrc file
Reboot the virtual environment
The garbled characters have been successfully resolved.
Recommended Posts