matplotlib.pyplot.ylim¶
-
matplotlib.pyplot.
ylim
(*args, **kwargs)[源代码]¶ 获取或设置当前轴的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
如果不指定参数,则可以通过 底部 或 top 作为Kwargs,即:
ylim(top=3) # adjust the top leaving bottom unchanged ylim(bottom=1) # adjust the bottom leaving top unchanged
设置限制将关闭Y轴的自动缩放。
返回: - 底部,顶部
新Y轴限制的元组。
笔记
在没有参数的情况下调用此函数(例如
ylim()
)pyplot是否等同于调用get_ylim
在当前轴上。用参数调用此函数与调用set_ylim
在当前轴上。不过,所有参数都会被传递。