2808 explained code solutions for 75 technologies


python-matplotlibHow to make equal axes


Using set_aspect() can help make sure axes are equal:

import matplotlib.pyplot as plt
plt.plot([1,2,3])
ax = plt.gca()
ax.set_aspect(1)
plt.show()ctrl + c
import matplotlib.pyplot as plt

loads Matplotlib module to use plotting capabilities

.plot(

plot specified data

.gca()

returns current axes object

set_aspect(1)

make chart aspect ratio is 1:1

.show()

render chart in a separate window