当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Python matplotlib ylim用法及代码示例


本文简要介绍 python 语言中 matplotlib.pyplot.ylim 的用法。

用法

matplotlib.pyplot.ylim(*args, **kwargs)

获取或设置当前轴的y-limits。

调用签名:

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,您也可以将 bottomtop 作为 kwargs 传递,即:

ylim(top=3)  # adjust the top leaving bottom unchanged
ylim(bottom=1)  # adjust the bottom leaving top unchanged

设置限制会关闭 y 轴的自动缩放。

返回
底部,顶部

新 y 轴范围的元组。

注意

不带参数调用此函数(例如 ylim() )相当于在当前轴上调用 get_ylim 的 pyplot。使用参数调用此函数相当于在当前轴上调用 set_ylim 的 pyplot。所有参数都通过了。

相关用法


注:本文由纯净天空筛选整理自skytowner.com大神的英文原创作品 matplotlib.pyplot.ylim。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。