plt绘图标题设置

 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()

 

 

 

 

 

 

 

 

 

 

 

posted @ 2020-03-23 22:19  牛公的跑奔  阅读(11389)  评论(0编辑  收藏  举报
总访问量:AmazingCounters.com