我在写我的科学文章,我的副标题有问题。 不幸的是,我得到的色条比图形要高得多。你知道吗
我读了这篇文章:Matplotlib: same height for colorbar as for plot
但我没有找到一种方法来覆盖我的脚本,以调整我的颜色栏。你知道吗
这是我的脚本和我的调整大小尝试:
fig3, (ax1, ax2, ax3) = plt.subplots(1,3)
fig = plt.gcf()
fig.set_size_inches(16, 9)
convolution_locale = convolve(RotatePlot, Gaussian2DKernel(stddev=4)) # AFFICHAGE DE LA CARTE DE DENSITE CONVOLUEE POUR 2'
fig_smoothed_heatmap_locale = ax1.imshow(convolution_locale, interpolation='nearest')
ax1.set_title("Carte de densite convoluee 2'")
ax1.set_xlabel("X (arcmin)")
ax1.set_ylabel("Y (arcmin)")
divider = make_axes_locatable(ax1)
cax1 = divider.append_axes("right", size="5%", pad=0.05)
fig3.colorbar(fig_smoothed_heatmap_locale,cax=cax1)
ax1.invert_yaxis()
convolution_grande = convolve(RotatePlot, Gaussian2DKernel(stddev=32)) # AFFICHAGE DE LA CARTE DE DENSITE CONVOLUEE POUR 8'
fig_smoothed_heatmap_grande = ax2.imshow(convolution_grande, interpolation='nearest')
ax2.set_title("Carte de densite convoluee 16'")
ax2.set_xlabel("X (arcmin)")
ax2.set_ylabel("Y (arcmin)")
divider = make_axes_locatable(ax1)
cax2 = divider.append_axes("right", size="5%", pad=0.05)
fig3.colorbar(fig_smoothed_heatmap_grande,cax=cax2)
ax2.invert_yaxis()
convolution_diff = convolution_locale - convolution_grande # AFFICHAGE DE LA CARTE DE DENSITE CONVOLUEE 2' - 8'
fig_smoothed_tab_diff = ax3.imshow(convolution_diff, interpolation='nearest')
ax3.set_title("Carte 2' - Carte 16'")
ax3.set_xlabel("X (arcmin)")
ax3.set_ylabel("Y (arcmin)")
divider = make_axes_locatable(ax1)
cax3 = divider.append_axes("right", size="5%", pad=0.05)
fig3.colorbar(fig_smoothed_tab_diff,cax=cax3)
ax3.invert_yaxis()
# Create space for labels between subplots
fig3.tight_layout()
fig3.savefig(outname3)
这就是我得到的:
如果你有解决办法,谢谢你!:)
问题是在创建3
divider
实例时总是使用ax1
。你知道吗将第二个和第三个
dividers
改为使用ax2
和ax3
,例如:这是你的整个剧本,有固定的台词:
相关问题 更多 >
编程相关推荐