在 Matplotlib 中,可以使用 pyplot.xlim()
和 pyplot.ylim()
函数来设置 x 轴和 y 轴的范围。例如,下面的代码将 x 轴的范围设置为 0 到 10,y 轴的范围设置为 -1 到 1:
import matplotlib.pyplot as plt
plt.xlim(0, 10)
plt.ylim(-1, 1)
在 Matplotlib 中,可以使用 pyplot.xlim()
和 pyplot.ylim()
函数来设置 x 轴和 y 轴的范围。例如,下面的代码将 x 轴的范围设置为 0 到 10,y 轴的范围设置为 -1 到 1:
import matplotlib.pyplot as plt
plt.xlim(0, 10)
plt.ylim(-1, 1)