It doesn't matter, but this is my first post. I was doing Knock 100 language processing with Python3, and when I tried to display the graph with matplotlib, I was in agony with the Japanese display. So don't forget to make a note.
Wisdom of ancestors + *** Delete cache file ***
is.
From here [Seaborn] Display Japanese (change font)
or Below is the method I tried (recommended because it is new?). I think it will definitely work here.
If you have completed the wisdom setting of your ancestors, skip it and go to [1-2. Delete cache](http://qiita.com/kamuiroeru/items/6853f14dc493ec5063f7#1-2-Delete cache file).
Bring a suitable font and install it.
I will use IPAex font following my predecessor. After downloading and unzipping, there should be a file called ipaexg.ttf, so let's install it as it is (double-click ipaexg.ttf in Finder).
Look for rcmod.py
. The ancestor
python_install_folder/lib/site-package/seaborn
It says that it is inside.
But in my environment (because it is managed by pyenv)
~/.pyenv/versions/3.5.2/lib/python3.5/site-packages/seaborn
It was in.
2016/12/25 postscript:
When I reintroduced the environment with anaconda, it was in a deeper hierarchy.
~/.pyenv/versions/anaconda3-[versionNum]/lib/python3.5/site-packages/seaborn
Once you find rcmod.py
, make two changes in the editor (after backing it up).
Around lines 81 and 82
def set(context="notebook", style="darkgrid", palette="deep",
font="sans-serif", font_scale=1, color_codes=False, rc=None):
Around line 190
"font.family": ["sans-serif"],
of
" san-serif "
to " IPAexGothic "(new font name)
Change to.
Save and complete the seaborn font settings. Japanese display is not possible yet.
You can see the installed fonts from Font Book.
Look at the Family
item in the details view. In this case, it's Migu 1P
.
Specify the item name written in this family
as the new font name.
Example
Changed " san-serif "
to " Migu 1P "(new font name)
Sorry I made you wait. This is the main subject. To put it simply,
fontList.py3k.cache Or *** Erase fontList.json! !! !! !! *** ***
that's all. Probably in ``` ~ / .matplotlib /` ``. It's the directory where matplotlibrc is located. If there are more than one, the one directly under the home directory should take precedence.
Let's delete it quickly.
cd ~/.matplotlib
After,
rm -f fontList.py3k.cache
rm -f fontList.json
Now let's run matplotlib. I think it will take longer than usual because the cache file will be recreated ... how is it? It went well?
** 2018/02/05 postscript **
With the recent matplotlib (version 2.1.0),
FontList.py3k.cache
was not found and was reflected by deleting fontList.json
.
(Since it is my own reasoning, it may contain mistakes etc.)
It seems that matplotlib makes a cache file of what font file exists at the first startup and then reads it.
Source matplotlib official GitHub issue Won't use a font although it can be found by the FontManager #3590
you'll need to remove the fontList.cache file everytime you want matplotlib to discover new fonts.
Because there is a reply
It seems that every time you change the font settings ** you have to change the cache file **.
Recommended Posts