1

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:

resulting graph

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'.

swiss_knight
  • 5,787
  • 8
  • 50
  • 92
  • 1
    Does this answer your question? [matplotlib (equal unit length): with 'equal' aspect ratio z-axis is not equal to x- and y-](https://stackoverflow.com/questions/13685386/matplotlib-equal-unit-length-with-equal-aspect-ratio-z-axis-is-not-equal-to) – sehan2 Jul 12 '21 at 20:47
  • @sehan2 Probably - it does answer mine. Thanks! – AstroFloyd Apr 15 '22 at 12:30

0 Answers0