I am making a 4 panel plot and was wondering if there is any way to just move the subplot in the bottom left down a bit so it stays in line with the rest of the plots and the titles don't overlay. I believe it is because the bottom left plot doesn't have a colorbar but I'm not sure how I would fix that. I am using the add subplot function. So for the bottom left pot the axes looks like this. ax = fig.add_subplot(2,2,3,projection=proj)
CodePudding user response:
I think it might work to read the current position with ax.get_position()
, then move it down a bit with ax.set_position()
. Something like this:
fig, axs = plt.subplots(2, 2)
pos = axs[1, 0].get_position()
new_pos = [pos.x0, pos.y0-0.1, pos.width, pos.height]
axs[1, 0].set_position(new_pos)
This results in:
As for 'how much?'... Not sure if there's a better way than trial and error though. Not ideal.
CodePudding user response:
See also Placing Colorbars.