這樣的事情?更改寬度比率將改變各個子圖的尺寸。
fig, [ax1, ax2, ax3] = plt.subplots(1,3, gridspec_kw = {'width_ratios':[3, 2, 1]}, figsize=(10,10))
plt.show()
如果你想擁有超過您也可以使用軸大小一些更多的控制。它仍然是相對的,但現在只是整個數字的一小部分。
import matplotlib.pyplot as plt
# use plt.Axes(figure, [left, bottom, width, height])
# where each value in the frame is between 0 and 1
# left
figure = plt.figure(figsize=(10,3))
ax1 = plt.Axes(figure, [.1, .1, .25, .80])
figure.add_axes(ax1)
ax1.plot([1, 2, 3], [1, 2, 3])
# middle
ax2 = plt.Axes(figure, [.4, .1, .25, .80])
figure.add_axes(ax2)
ax2.plot([1, 2, 3], [1, 2, 3])
# right
ax3= plt.Axes(figure, [.7, .1, .25, .80])
figure.add_axes(ax3)
ax3.plot([1, 2, 3], [1, 2, 3])
plt.show()
[在matplotlib插曲集大小]的可能的複製(https://stackoverflow.com/questions/41530975/set-size-of-subplot-in-matplotlib) – Dadep
您可以發佈您的代碼? – Dadep
通過添加任何軸或更改其大小,圖形大小不會更改。沒有簡單的選擇將軸定位在絕對座標中,但當然這可以根據圖大小和相對座標來計算。無論如何,如果您需要幫助,您需要顯示問題的[mcve]。 – ImportanceOfBeingErnest