diff --git a/lectures/matplotlib.md b/lectures/matplotlib.md index 377acfc..8ffd244 100644 --- a/lectures/matplotlib.md +++ b/lectures/matplotlib.md @@ -305,6 +305,7 @@ def draw_graphs(style='default'): # 设置样式表 plt.style.use(style) + plt.rcParams['font.family'] = ['Source Han Serif SC', 'DejaVu Sans'] # i18n:样式表会重置 font.family,须在 style.use 之后重新应用 fig, axes = plt.subplots(nrows=1, ncols=4, figsize=(10, 3)) x = np.linspace(-13, 13, 150) diff --git a/lectures/pandas_panel.md b/lectures/pandas_panel.md index 171b2aa..d55db15 100644 --- a/lectures/pandas_panel.md +++ b/lectures/pandas_panel.md @@ -52,7 +52,7 @@ FONTPATH = "_fonts/SourceHanSerifSC-SemiBold.otf" # i18n mpl.font_manager.fontManager.addfont(FONTPATH) # i18n mpl.rcParams['font.family'] = ['Source Han Serif SC'] # i18n import seaborn as sns -sns.set_theme() +sns.set_theme(rc={'font.family': ['Source Han Serif SC', 'DejaVu Sans']}) # i18n:set_theme 会重置字体,用 rc 覆盖保留中文字体 ``` ## 概述