53. Multilanguages Font#

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from pandas.plotting import scatter_matrix

import seaborn as sns
sns.set_style("white")
fig_w = 2530
fig_h = 1900
my_dpi=200

plt.style.use('ggplot')
# #coding:utf-8
# from matplotlib import rcParams
# plt.rcParams['font.sans-serif'] = ['SimHei']  # 用来正常显示中文标签
# plt.rcParams['axes.unicode_minus'] = False  # 用来正常显示负号
plt.rc('font', family='BabelStone Han', size=13)
plt.plot([1,2,3,4,5])
plt.title(u'标题')
plt.show()
findfont: Font family ['BabelStone Han'] not found. Falling back to DejaVu Sans.
findfont: Font family ['BabelStone Han'] not found. Falling back to DejaVu Sans.
/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/matplotlib/backends/backend_agg.py:240: RuntimeWarning: Glyph 26631 missing from current font.
  font.set_text(s, 0.0, flags=flags)
/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/matplotlib/backends/backend_agg.py:240: RuntimeWarning: Glyph 39064 missing from current font.
  font.set_text(s, 0.0, flags=flags)
/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/matplotlib/backends/backend_agg.py:203: RuntimeWarning: Glyph 26631 missing from current font.
  font.set_text(s, 0, flags=flags)
/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/matplotlib/backends/backend_agg.py:203: RuntimeWarning: Glyph 39064 missing from current font.
  font.set_text(s, 0, flags=flags)
../../_images/matplotlib_multilanguages_4_3.png