# Here we set the stickiness of the axes object... # ax1 we'll leave as the default, which uses sticky edges # and we'll turn off stickiness for ax2 ax2.use_sticky_edges = False
for ax, status inzip((ax1, ax2), ('Is', 'Is Not')): cells = ax.pcolor(x, y, x+y, cmap='inferno') # sticky ax.add_patch( plt.Polygon(poly_coords, color='forestgreen', alpha=0.5) ) # not sticky ax.margins(x=0.1, y=0.05) ax.set_aspect('equal') ax.set_title('{} Sticky'.format(status))