(ax)
Sets equal aspect ratio across the three axes of a 3D plot.

        Contributed by Xuefeng Zhao.

        :param ax: a Matplotlib axis, e.g., as output from plt.gca().
Sets equal aspect ratio across the three axes of a 3D plot.
Sets equal aspect ratio across the three axes of a 3D plot .
def set_axes_equal(ax):
        """ Sets equal aspect ratio across the three axes of a 3D plot.

        Contributed by Xuefeng Zhao.

        :param ax: a Matplotlib axis, e.g., as output from plt.gca().
        """
        bounds = [ax.get_xlim3d(), ax.get_ylim3d(), ax.get_zlim3d()]
        ranges = [abs(bound[1] - bound[0]) for bound in bounds]
        centers = [np.mean(bound) for bound in bounds]
        radius = 0.5 * max(ranges)
        lower_limits = centers - radius
        upper_limits = centers + radius
        ax.set_xlim3d([lower_limits[0], upper_limits[0]])
        ax.set_ylim3d([lower_limits[1], upper_limits[1]])
        ax.set_zlim3d([lower_limits[2], upper_limits[2]])
def set_axes_equal ( ax ) : bounds = [ ax . get_xlim3d ( ) , ax . get_ylim3d ( ) , ax . get_zlim3d ( ) ] ranges = [ abs ( bound [ 1 ] - bound [ 0 ] ) for bound in bounds ] centers = [ np . mean ( bound ) for bound in bounds ] radius = 0.5 * max ( ranges ) lower_limits = centers - radius upper_limits = centers + radius ax . set_xlim3d ( [ lower_limits [ 0 ] , upper_limits [ 0 ] ] ) ax . set_ylim3d ( [ lower_limits [ 1 ] , upper_limits [ 1 ] ] ) ax . set_zlim3d ( [ lower_limits [ 2 ] , upper_limits [ 2 ] ] )