GridSpec(nrows, ncols, figure=none, left=none, bottom=none, right=none, top=none, wspace=none, hspace= none, width_rations=none, height_rations=none)
nrows:行数
ncols:列数
figure:表示布局的画布
left,bootom,right,top表示子图范围
wspace,hspaec表示子图之间预留的宽度量,高度量
width_rations表示直接设置坐标系相对宽度,相对宽度=设定值/sum
height_rations表示直接设置坐标系相对高度,相对高度=设定值/sum
# matplotlib中文网 https://www.matplotlib.org
# 需求一:利用自定义布局的GridSpec实例,在画布上创建如图所示的坐标系实例(见运行结果展示图)
%matplotlib notebook
import matplotlib.pyplot as gridspec
#1.创建画布实例
fig=plt.figure()
#2.创建“区域规划图”实例
spec=gridspec.GridSpec(3,8,figure=fig)
#3.根据给定的“区域规划图”,创建对应的坐标系实例
ax1=plt.subplot(spec[0,:])
ax1=plt.subplot(spec[1,0:4])
ax1=plt.subplot(spec[1,4:8])
ax1=plt.subplot(spec[2,0:2],projection='polar')
ax1=plt.subplot(spec[2,3:8])
plt.show()