[英]Matplotlib: How do we control figure border and axes borders padding with respect to figure and between multiple axes as well?
無法使用 fig.add_axes 或 plt.subplot_adjust 控制圖形邊框和軸邊框相對於圖形和多個軸之間的填充
Code:
import matplotlib.pyplot as plt8
`axs=[]
fig=plt8.figure(figsize=(6.0,4.0),edgecolor='red',linewidth=10,dpi=100)
print(fig)
ax1=fig.add_axes([0.6,1,2.0,1.5])
axs+=[ax1]
ax2=fig.add_axes([3.3,1,2.0,1.5])
axs+=[ax2]`
Description:
這是 figsize=(6.0,4.0) 根據我給的坐標,我想在上圖中有 2 個矩形圖
兩個地塊之間的間隙為 0.7,兩個地塊的寬度 = 2.0 兩個地塊的高度 = 1.5 相對於圖形的左墊為 0.6 右墊為 1.1 上墊為 1.5 下墊為 1
But this is not working , can anyone suggest solution code ?
調用add_axes()
時使用的尺寸需要是圖形的分數(參見此處)。
所需的元組是“(left, bottom, width, height)”。
所以:
ax1=fig.add_axes([0.6/6.0, 1.0/4.0, 2.0/6.0, 1.5/4.0])
ax2=fig.add_axes([3.3/6.0, 1.0/4.0, 2.0/6.0, 1.5/4.0])
除以 6.0,對於左側位置和寬度,假設您將 6.0 指定為圖形寬度。 除以 4.0,得到底部位置和高度,假設您指定 4.0 作為圖形高度。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.