我制作了一个带有 3 个轴的图形。每个轴都是具有相同颜色条的热图。我只想保留第三个轴的颜色条并隐藏第一个和第二个颜色条(但保持热图位置不变)。我怎么能做到?
这是我的代码:
fig=plt.figure()
grid = plt.GridSpec(4, 6)
plt.subplot(grid[0:2,0:5])
ax1=sns.heatmap(df_norm, cmap='Reds', vmin=0.05, vmax=0.7)
ax1.axes.get_yaxis().set_visible(False)
ax1.xaxis.tick_top()
ax1.set_xticklabels(col, rotation=90)
plt.subplot(grid[2,0:5])
ax2=sns.heatmap(df_tgfup, cmap='Reds', vmin=0.05, vmax=0.7)
ax2.axes.get_xaxis().set_visible(False)
ax2.axes.get_yaxis().set_visible(False)
ax2.xaxis.tick_top()
ax2.set_xticklabels(col, rotation=90)
plt.subplot(grid[3,0:5])
ax3=sns.heatmap(df_tgfdown, cmap='Reds', vmin=0.05, vmax=0.7)
ax3.axes.get_xaxis().set_visible(False)
ax3.axes.get_yaxis().set_visible(False)
ax3.xaxis.tick_top()
ax3.set_xticklabels(col, rotation=90)
Run Code Online (Sandbox Code Playgroud)
这是我做的无花果:

这是我想做的无花果:
