我該如何解決這個情節?如何使用gridspec調整列寬?
我想:
- 兩個彩條不重疊。
- 使它們的高度等於情節。
這裏是我的代碼:
combined = (...) # some irrelevant to question data praparation - this variable contain square matrix with RGBA chanels
plt.figure(dpi=300, figsize=(2.1,1.9))
gs = gridspec.GridSpec(1, 3, width_ratios=[20,1,1])
ax1 = plt.subplot(gs[0])
ax2 = plt.subplot(gs[1])
ax3 = plt.subplot(gs[2])
cax = ax1.imshow(combined, interpolation="None")
mpl.colorbar.ColorbarBase(ax2, cmap=cmap_top, norm=norm_top)
mpl.colorbar.ColorbarBase(ax3, cmap=cmap_top, norm=norm_top)
我使用python 3.6和2.0 matplotlib。