I'm plotting a set of 3d coordinates (x,y,z) using Axes3D. My code reads
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
x,y,z=data[::1,0],data[::1,1],data[::1,2]
fig=plt.figure(figsize=(10,10))
ax=fig.add_subplot(111,projection='3d')
ax.scatter(x,y,z,s=0.1,c=z,cmap='hot',marker='+')
plt.show()
I want all three axes to have the same scaling. Now, the problem is that the data has a large aspect ratio, that is, the variation in the x and y coordinates is about 10 times larger than the variation in the z coordinate. If I put
mi=np.min(data)
ma=np.max(data)
ax.set_xlim(mi,ma)
ax.set_ylim(mi,ma)
ax.set_zlim(mi,ma)
this will result in uniformly scaled axes but will waste a lot of space in the z direction. How can I avoid this and get uniformly scaled axes nevertheless?