导入Matplotlib

约定俗成的以 plt 为 Matplotlib 简称的导入方式

1
import matplotlib.pyplot as plt

魔法配置,让表格显示在 jupyter 里面

1
%matplotlib notebook

中文字体支持配置

第一种方法

  1. 打印所有系统字体
1
2
for i in sorted([f.name for f in mpl.font_manager.fontManager.ttflist]):
print(i)
  1. 找到一个可以显示中文的字体
1
2
3
# 比如我使用的 Songti SC
# 将其设置为当前字体
plt.rcParams['font.family']=['Songti SC']
阅读全文