我想用 matplotlib 绘制数据,其中相等的 x 和 y 增量具有相同的长度。这适用于
ax1.axis('equal')
其中 ax1 是一个子图 ()
但是像这样设置下限:
ax1.set_xlim(left=lowerlimit)
ax1.set_ylim(bottom=lowerlimit)
没用。我也试过这样的东西也没有用:
ax1.axis('equal', xmin=lowerlimit,ymin=lowerlimit)
谁能帮帮我?
编辑: 这是一个显示问题的最小示例:
import matplotlib.pyplot as plt
fig, ax1 = plt.subplots()
x = [0,1,2,3,4,5]
y = [0,-1,-3,-2,-1,-2]
ax1.plot(x,y)
ax1.set_xlim(0,6)
ax1.set_ylim(0,-6)
ax1.axis('equal')
ax1.set_ylim(bottom=0)
plt.show()
尽管我在调用 ax1.set_ylim(bottom=0) 后明确将 y 轴的下限设置为 0,但绘图的下限是 -1。
请您参考如下方法:
