def set_axes_equal(ax: plt.Axes, limits=None):
    "Set 3D plot axes to equal scale.\n\n        Make axes of 3D plot have equal scale so that spheres appear as\n        spheres and cubes as cubes.  Required since `ax.axis('equal')`\n        and `ax.set_aspect('equal')` don't work on 3D.\n        "
    if (limits is None):
        limits = np.array([ax.get_xlim3d(), ax.get_ylim3d(), ax.get_zlim3d()])
    origin = np.mean(limits, axis=1)
    radius = (0.5 * np.max(np.abs((limits[:, 1] - limits[:, 0]))))
    _set_axes_radius(ax, origin, radius)
Set 3D plot axes to equal scale.

Make axes of 3D plot have equal scale so that spheres appear as
spheres and cubes as cubes.  Required since `ax.axis('equal')`
and `ax.set_aspect('equal')` don't work on 3D.
def set_axes_equal(ax: plt.Axes, limits=None):
    "Set 3D plot axes to equal scale.\n\n        Make axes of 3D plot have equal scale so that spheres appear as\n        spheres and cubes as cubes.  Required since `ax.axis('equal')`\n        and `ax.set_aspect('equal')` don't work on 3D.\n        "
    if (limits is None):
        limits = np.array([ax.get_xlim3d(), ax.get_ylim3d(), ax.get_zlim3d()])
    origin = np.mean(limits, axis=1)
    radius = (0.5 * np.max(np.abs((limits[:, 1] - limits[:, 0]))))
    _set_axes_radius(ax, origin, radius)