How do I equalize the scales of the x-axis and y-axis?
--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Melt
--
Chapters
00:00 How Do I Equalize The Scales Of The X-Axis And Y-Axis?
00:20 Answer 1 Score 25
00:28 Accepted Answer Score 315
00:42 Answer 3 Score 105
00:50 Answer 4 Score 74
01:11 Thank you
--
Full question
https://stackoverflow.com/questions/1799...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #matplotlib
#avk47
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Melt
--
Chapters
00:00 How Do I Equalize The Scales Of The X-Axis And Y-Axis?
00:20 Answer 1 Score 25
00:28 Accepted Answer Score 315
00:42 Answer 3 Score 105
00:50 Answer 4 Score 74
01:11 Thank you
--
Full question
https://stackoverflow.com/questions/1799...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #matplotlib
#avk47
ACCEPTED ANSWER
Score 315
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()
ANSWER 2
Score 105
plt.axis('scaled')
works well for me.
ANSWER 3
Score 74
See the documentation on plt.axis(). This:
plt.axis('equal')
doesn't work because it changes the limits of the axis to make circles appear circular. What you want is:
plt.axis('square')
This creates a square plot with equal axes.
ANSWER 4
Score 25
Try something like:
import pylab as p
p.plot(x,y)
p.axis('equal')
p.show()