You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If Axes3d was repositioned by set_position() prior to figure size change, it will not adjust its size. Normal axes behave differently.
Code for reproduction
importmatplotlib.pyplotaspldefadjustPos(ax, shift=-0.08):
pos=ax.get_position()
ax.set_position(pos.translated(shift, 0))
#axes gridN=10C=2fig=pl.figure() #default (small) sizefig2=pl.figure()
fig2.set_size_inches(7,2*N)
defadjustPos(ax, shift=-0.08):
pos=ax.get_position()
ax.set_position(pos.translated(shift, 0))
foriiinrange(N):
#add and shift (by zero) normal and 3d axesax=fig.add_subplot(N, C, 1+ii*C)
adjustPos(ax, 0)
ax=fig.add_subplot(N, C, 1+ii*C+1, projection="3d")
adjustPos(ax, 0)
#the same for already large fig2ax=fig2.add_subplot(N, C, 1+ii*C)
adjustPos(ax, 0)
ax=fig2.add_subplot(N, C, 1+ii*C+1, projection="3d")
adjustPos(ax, 0)
fig.savefig("test_original_size.jpg", dpi=300)
fig.set_size_inches(7,2*N)
fig.savefig("test_large_size.jpg", dpi=300)
fig2.savefig("test_big_figure.jpg", dpi=300)
Actual outcome
If axes positions are adjusted by calling set_position(), even if the actual shift is 0, Axes3D will keep its size determined for the original size of figure.
Original figure size (axes do not fit comfortably):
Figure enlarged after axes are created and shifted:
This effect will not take place if set_position() is not called. The issue can be easily avoided by setting figure size ahead of axes creation as done with fig2:
However, I would expect this behaviour regardless of where the figure size is changed.
Matplotlib version
Operating system: Debian GNU/Linux 10
Matplotlib version (import matplotlib; print(matplotlib.__version__)): 3.4.2
Bug report
Bug summary
If Axes3d was repositioned by set_position() prior to figure size change, it will not adjust its size. Normal axes behave differently.
Code for reproduction
Actual outcome
If axes positions are adjusted by calling set_position(), even if the actual shift is 0, Axes3D will keep its size determined for the original size of figure.


Original figure size (axes do not fit comfortably):
Figure enlarged after axes are created and shifted:
This effect will not take place if set_position() is not called. The issue can be easily avoided by setting figure size ahead of axes creation as done with fig2:

However, I would expect this behaviour regardless of where the figure size is changed.
Matplotlib version
import matplotlib; print(matplotlib.__version__)
): 3.4.2print(matplotlib.get_backend())
): Qt5AggThe text was updated successfully, but these errors were encountered: