Here's a barebones example:
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure()
f = fig.add_subplot(2, 1, 1, projection='3d')
t = fig.add_subplot(2, 1, 2, projection='3d')
# axes
for d in {f, t}:
d.plot([-1, 1], [0, 0], [0, 0], color='k', alpha=0.8, lw=2)
d.plot([0, 0], [-1, 1], [0, 0], color='k', alpha=0.8, lw=2)
d.plot([0, 0], [0, 0], [-1, 1], color='k', alpha=0.8, lw=2)
f.dist = t.dist = 5.2 # 10 is default
plt.tight_layout()
f.set_aspect('equal')
t.set_aspect('equal')
r = 6
f.set_xlim3d([-r, r])
f.set_ylim3d([-r, r])
f.set_zlim3d([-r, r])
t.set_xlim3d([-r, r])
t.set_ylim3d([-r, r])
t.set_zlim3d([-r, r])
f.set_axis_off()
t.set_axis_off()
plt.draw()
plt.show()
This is what I get:
This is what I want:
In other words, I want the plots themselves to have a square aspect ratio, not all stretched out like this:
and I got that part working thanks to https://mcmap.net/q/120266/-how-to-set-the-39-equal-39-aspect-ratio-for-all-axes-x-y-z
but I want the windows looking into those plots to be rectangular, with the top and bottom cropped out (since there will just be white space on top and bottom and I'm generating multiple animated GIFs so I can't easily post-process it to the shape I want).
Basically I am making this animation, and I want the same thing but without all the whitespace:
fig.subplots_adjust(top = 1, bottom = 0, right = 1, left = 0, hspace = 0, wspace = 0)
? – Alcibiadesr
– Alcibiades