小编use*_*079的帖子

将第三个子图放在第二行 python 的中间

我有一个由 3 个子图组成的图形。我想将最后一个子图定位在第二行中间。目前它位于图的左下角。我该怎么做呢?我找不到堆栈溢出的答案。

    fig, axes = plt.subplots(nrows=2, ncols=2, figsize=(13,10))
    ax= axes.flatten()
    ax[0].plot(vDT, np.cumsum(mWopt0[asset0,:])*percentage/iTT, label= 'COAL, c = 0')
    ax[0].legend()
    ax[0].set_title('Proportion in most invested stock')
    ax[1].plot(vDT, np.cumsum(mWopt01[asset01,:])*percentage/iTT, label= 'OINL, c = 0.1')
    ax[1].plot(vDT, np.cumsum(mWopt03[asset03,:])*percentage/iTT, label= 'OINL, c = 0.3')
    ax[1].plot(vDT, np.cumsum(mWopt05[asset05,:])*percentage/iTT, label= 'OINL, c = 0.5')
    ax[1].plot(vDT, np.cumsum(mWopt2[asset2,:])*percentage/iTT, label= 'OINL, c = 2')
    ax[1].plot(vDT, np.cumsum(mWopt5[asset5,:])*percentage/iTT, label= 'OINL, c = 5')
    ax[1].plot(vDT, np.cumsum(mWopt10[asset10,:])*percentage/iTT, label= 'OINL, c = 10')
    ax[1].legend()
    ax[1].set_title('Proportion in most invested stock')
    ax[2].plot(vDT, np.cumsum(mWopt01[index,:])*percentage/iTT, label= 'c = 0')
    ax[2].plot(vDT, np.cumsum(mWopt01[index,:])*percentage/iTT, …
Run Code Online (Sandbox Code Playgroud)

python figure subplot

6
推荐指数
1
解决办法
7767
查看次数

标签 统计

figure ×1

python ×1

subplot ×1