matplotlib.pyplot.ylim#
- matplotlib.pyplot.ylim(*args, **kwargs)[source]#
获取或设置当前Axes的y轴限制。
调用签名
bottom, top = ylim() # return the current ylim ylim((bottom, top)) # set the ylim to bottom, top ylim(bottom, top) # set the ylim to bottom, top
如果不指定args,您可以选择将bottom或top作为kwargs传入,即。
ylim(top=3) # adjust the top leaving bottom unchanged ylim(bottom=1) # adjust the bottom leaving top unchanged
设置限制会关闭y轴的自动缩放功能。
- 返回:
- bottom, top
一个包含新y轴限制的元组。
备注
不带参数调用此函数(例如
ylim()
)等同于在当前Axes上调用get_ylim
。带参数调用此函数等同于在当前Axes上调用set_ylim
。所有参数都会直接传递。