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


Python matplotlib ion用法及代码示例


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

用法

matplotlib.pyplot.ion()

启用交互模式。

有关详细信息,请参阅 pyplot.isinteractive

注意

对于临时更改,这可以用作上下文管理器:

# if interactive mode is off
# then figures will not be shown on creation
plt.ioff()
# This figure will not be shown immediately
fig = plt.figure()

with plt.ion():
    # interactive mode will be on
    # figures will automatically be shown
    fig2 = plt.figure()
    # ...

为了启用作为上下文管理器的可选用途,此函数返回一个 ExitStack 对象,该对象不打算由用户存储或访问。

相关用法


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