作者:芸阁__907 | 来源:互联网 | 2023-09-18 02:42
1 import matplotlib.pyplot as plt
2
3 plt.rcParams[‘font.family‘] = ‘SimHei‘
4
5 fig = plt.figure(facecolor = ‘lightgrey‘)
6
7 plt.subplot(2,2,1)
8 plt.title(‘子标题‘)
9 plt.subplot(2,2,2)
10 plt.title(‘子标题2‘, loc = ‘left‘,color = ‘b‘)
11 plt.subplot(2,2,3)
12 myfOntdict= {‘fontsize‘:12, ‘color‘:‘g‘, ‘rotation‘:30}
13 plt.title(‘子标题3‘, fOntdict= myfontdict)
14 plt.subplot(2,2,4)
15 plt.title(‘子标题4‘, color = ‘white‘,backgroundcolor=‘black‘)
16
17 plt.suptitle(‘全局标题‘,fOntsize= 20, color = ‘red‘,backgroundcolor=‘yellow‘)
18 plt.tight_layout(rect=(0,0,1,0.9))#使子图标题和全局标题与坐标轴不重叠
19
20 plt.show()