Difference between axis('equal') and axis('scaled') in matplotlib

Viewed 13209

In the reference, they are described as:

axis('equal') changes limits of x or y axis so that equal increments of x and y have the same length; a circle is circular.:

axis('scaled') achieves the same result by changing the dimensions of the plot box instead of the axis data limits.:

But I did not understand the part 'by changing the dimensions of the plot box'. So I compared directly

import numpy as np
import matplotlib.pyplot as plt

plt.close('all')

x = np.array(np.linspace(-np.pi, np.pi))
y = np.sin(x)

ax1 = plt.subplot(2, 1, 1)
ax1 = plt.plot(x, y)
plt.axis('scaled')

ax1 = plt.subplot(2, 1, 2)
plt.plot(x, y)
plt.axis('equal')

enter image description here

There is only a slight difference that the width is shorter when plotted with plt.axis('scaled').

How can I know the difference better?

1 Answers
Related