I have a minimum example of my code as follows:
import matplotlib.pyplot as plt
fig = plt.figure(1, figsize=(16, 9))
ax = fig.add_subplot(projection='3d',elev=-150, azim=110)
plt.tight_layout()
plt.show()
If run my .py script i get following plot with a lot of white spaces on the left and right. Is it possible to fit the subplot to the defined figsize? In a previous python version there were no whitespaces, but since i use python 3.9.4 together with matplotlib 3.5.2 the subplot has white spaces on the left and right. Hope someone can help me with this issue.
>Solution :
using set_box_aspect(), you can set aspect ratio for Matplotlib 3d box, look from this link
so in your case, add this line after you define ax (before plt)
ax.set_box_aspect((20, 16, 9))
