matplotlib:gridspec.GridSpec()

import numpy as np
import matplotlib
matplotlib.use(“TkAgg”)
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.gridspec as gridspec

plt.figure()

gs=gridspec.GridSpec(3,3)#分为3行3列
ax1=plt.subplot(gs[0,:])
ax1=plt.subplot(gs[1,:2])
ax1=plt.subplot(gs[1:,2])
ax1=plt.subplot(gs[-1,0])
ax1=plt.subplot(gs[-1,-2])

plt.show()
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_43055882/article/details/86518052