Scale only 2 axis in a 3d matplotlib

Consider the case where a maplotlib 3d plot have 2 axis that represents the same kind of measurement (for example a length) and another one of a different kind (for example time). I would like to scale only 2 axis (the ones representing the length) but not the other one.
In a 2d plot I would do this with ax.axis("equal"), but this command scales all the axis.

Is there a way to do that?

>Solution :

The Axes3D class has a set_aspect method, which allows you to set the aspect ratio of any pair of axes to equal, e.g.:


to set the x-y axes to have equal aspect ratios, but leaving the z-axis scale unchanged.

Leave a Reply