Inspired from this thread, I am trying to plot a 3D graph from a list of tuples being 3D coordinates of points. The list in itself contains three tuples, hence three points, defining a triangle in space.
Here's a sample:
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d.art3d import Poly3DCollection
vertices = np.array([
[ 2.5800e+06, 1.1090e+06, 1.6817e+03],
[ 2.5300e+06, 1.1370e+06, 1.0996e+04],
[ 2.5300e+06, 1.1350e+06, 2.2508e+04]])
fig = plt.figure(figsize=(4,4))
ax = fig.add_subplot(111, projection='3d')
ax.set_xlim(2530000.0, 2550000.0)
ax.set_ylim(1100000.0, 1140000.0)
ax.set_zlim(1000., 2500.)
for i in range(4):
ax.add_collection3d(Poly3DCollection([vertices]))
plt.show()
The problem that I meet is that even when setting some bound values to the three axes of the plot, they don't seem to properly scale, and therefore, my triangle is having wrong proportions:
How could you preserve the same scale on the 3 axes of a 3D plot using matplotlib?
I tried setting plt.axis('equal')
but this shows this error:
NotImplementedError: Axes3D currently only supports the aspect argument 'auto'. You passed in 'equal'.