Position 5 subplots in Matplotlib

后端 未结 1 1974
名媛妹妹
名媛妹妹 2021-01-05 02:55

I would like to position 5 subplots such that there are three of top and two at the bottom but next to each other. The current code gets close but I would like the final res

相关标签:
1条回答
  • 2021-01-05 03:42

    You can use colspan When you use suplot2grid instead of subplot.

    import matplotlib.pyplot as plt
    
    ax1 = plt.subplot2grid(shape=(2,6), loc=(0,0), colspan=2)
    ax2 = plt.subplot2grid((2,6), (0,2), colspan=2)
    ax3 = plt.subplot2grid((2,6), (0,4), colspan=2)
    ax4 = plt.subplot2grid((2,6), (1,1), colspan=2)
    ax5 = plt.subplot2grid((2,6), (1,3), colspan=2)
    

    And then every subplot needs to be 2 cols wide, so that the subplots in the second row can be shifted by 1 column.

    0 讨论(0)
提交回复
热议问题