我有一个subplot安排,我试图用matplotlib.gridspec
来驯服。在示例HERE之后,我为我的情节想出了以下内容:
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
f = plt.figure()
gs1 = gridspec.GridSpec(1,1)
ax1 = plt.subplot(gs1[:,:])
gs2 = gridspec.GridSpec(1,2)
ax2 = plt.subplot(gs2[:,0])
ax3 = plt.subplot(gs2[:,1])
plt.show()
我希望得到三个子图,我明白了:
如何获得以下结果?:
答案 0 :(得分:1)
参见this示例(几乎逐字复制):
fig = plt.figure()
gs1 = gridspec.GridSpec(1,1)
gs1.update(left=0.05, right=0.33, wspace=0.05)
ax1 = fig.add_subplot(gs1[:,:])
gs2 = gridspec.GridSpec(1,2)
gs2.update(left=0.38, right=0.98, wspace=0.05)
ax2 = fig.add_subplot(gs2[:,0])
ax3 = fig.add_subplot(gs2[:,1])
plt.show()