[英]Matplotlib How to get the gap and whitespace distance between subplots (axes)
我可以知道是否有人知道如何打印子圖(軸)之間的空白距離嗎? 我有繪制兩個網格的代碼,您能幫我弄清楚如何為白色空間打印這些參數嗎?
grid_data = np.array([[[-0.1779874 , -0.90335705, -0.31157705, 0.77770067],
[ 0.93698288, 0.79215241, 0.10155888, 0.96101718],
[ 0.72994894, -0.83939131, 0.24713443, 0.74839211],
[ 0.10039462, -0.95778299, 0.43554077, 0.61927077]],
[[ 0.52294259, -0.0247383 , 0.23717517, -0.0857769 ],
[-0.43539246, 0.28503173, -0.39443502, -0.1478289 ],
[-0.2327904 , -0.08339054, 0.33072907, 0.74634504],
[-0.524284 , -0.72919194, -0.61543159, 0.17086563]]])
num_cols = 2
num_rows = 1
fig_size_h = 42/32*num_cols
fig_size_v = 14/10*num_rows
fig, axes = plt.subplots(nrows = num_rows, ncols = num_cols, figsize = (fig_size_h, fig_size_v))
for i in range(num_cols):
c = axes[i].pcolormesh(grid_data[i], cmap = 'RdBu_r', vmin = -1., vmax = 1.)
# Add a color bar
cb_ax = fig.add_axes([0.91, 0.13, 0.01, 0.75])
fig.colorbar(c, cax = cb_ax)
plt.show()
提前非常感謝您。
所有這些參數都可以使用以下方法進行調整:
https://matplotlib.org/3.1.1/api/_as_gen/matplotlib.pyplot.subplots_adjust.html
默認值也列出
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.