Python matplotlib - how to move colorbar without resizing the heatmap?
问题 Hi so I have the following commands. To specify a subplot axes in the grid for the heatmap: ax4 = plt.subplot2grid((3, 4), (1, 3), colspan=1, rowspan=1) To create my heatmap in this axes: heatmap = ax4.pcolor(data, cmap=mycm, edgecolors = 'none', picker=True) To move the plot to the right in order to center it in the axes according to other subplots: box = ax4.get_position() ax4.set_position([box.x0*1.05, box.y0, box.width * 1.05, box.height]) To show the colorbar with no padding fig.colorbar