簡體   English   中英

僅調整matplotlib中兩個子圖之間的距離

[英]Adjust the distance only between two subplots in matplotlib

我有3個子圖(3行1列)。 我們可以使用fig.subplots_adjust(hspace=0.2)來調整子圖之間的距離。 這將改變所有情況下子圖之間的距離。 如何在圖1(311)和圖2(312)以及圖2(312)和圖3(313)之間有不同的距離?

好問題。 嘗試這個:

from mpl_toolkits.axes_grid1 import make_axes_locatable 

ax1 = plt.subplot2grid((1,1), (0,0))
divider = make_axes_locatable(ax1) 
ax2 = divider.append_axes("bottom", size="100%", pad=0.5)
ax3 = divider.append_axes("bottom", size="100%", pad=1)

然后你會得到:

在此輸入圖像描述

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM