IPython Notebook, in the default state, the Japanese label in the graph becomes tofu, so I think that many people use it by specifying the Japanese font in the configuration file. However, after updating IPython to 3, the IPython Notebook became Jupyter, and Japanese became tofu again.
Apparently, the configuration of the configuration file has changed, so I can no longer use the existing Profile. ʻIpython_ * _ config.py` The default contents of the file with the same name as the existing one have changed, so it seems better to recreate each profile.
In IPython 3.x series, it seems that IPython 2.x series ʻipython_notebook_config.py is divided into ʻipython_kernel_config.py
and ʻipython_notebook_config.py`.
If you want to use Japanese labels in Matplotlib, you need to write them in ʻipython_kernel_config.py`.
ipython_kernel_config.py
c.InlineBackend.rc = {
'font.size': 11,
'font.family': 'Osaka',
'figure.figsize': (6.0, 4.0),
'savefig.dpi': 80,
'axes.titlesize': 12
}
c.InlineBackend.figure_formats = set(['png', 'retina'])
Now you can use Japanese labels.
On Jupyter
import matplotlib
matplotlib.rcParams.get('font.family')
The list of available fonts is
import matplotlib.font_manager as fm
fm.findSystemFonts()
Obtained at.
Recommended Posts