Ffi*_*ydd 16
plt.margins 可用于调整数据周围的自动填充,如下所示.
import matplotlib.pyplot as plt
import numpy as np
x = np.arange(10)
y = np.power(x, 3)
plt.plot(x, y, 'ro')
# Create a 5% (0.05) and 10% (0.1) padding in the
# x and y directions respectively.
plt.margins(0.05, 0.1)
plt.show()
Run Code Online (Sandbox Code Playgroud)

如果你有一个最小值500,并希望边境左右400,那么你可以选择的X保证金比例0.2为plt.margins(0.2, 0.2).