How do I equalize the scales of the x-axis and y-axis?

Use Axes.set_aspect in the following manner:

from matplotlib import pyplot as plt
plt.plot(range(5))
plt.xlim(-3, 3)
plt.ylim(-3, 3)
ax = plt.gca()
ax.set_aspect('equal', adjustable="box")
plt.draw()

Leave a Comment