matplotlib x y limit and aspect ratio

#Python #Matplotlib

matplotlib x y limit and aspect ratio

Use

plt.xlim(-1,1)
plt.gca().set_aspect('equal', adjustable='box')

if

plt.xlim(-1,1)
plt.axes().set_aspect('equal', 'datalim')

doesn’t work.

Published: by ;

Lei Ma (2016). 'matplotlib x y limit and aspect ratio', Datumorphism, 07 April. Available at: https://datumorphism.leima.is/til/programming/matplotlib-x-y-limit-and-aspect-ratio/.

Table of Contents

Current Ref:

  • til/programming/matplotlib-x-y-limit-and-aspect-ratio.md