mpl_gui.ion#

mpl_gui.ion()[源代码]#

启用交互模式。

有关详细信息,请参阅 is_interactive

另请参阅

ioff

禁用交互模式。

is_interactive

是否启用交互模式。

show

显示所有图形(并可能阻塞)。

注释

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

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

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

为了能够用作上下文管理器,此函数返回一个 _IonContext 对象。该返回值不应被用户存储或访问。