當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python matplotlib ioff用法及代碼示例

本文簡要介紹 python 語言中 matplotlib.pyplot.ioff 的用法。

用法

matplotlib.pyplot.ioff()

禁用交互模式。

有關詳細信息,請參閱 pyplot.isinteractive

注意

對於臨時更改,這可以用作上下文管理器:

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

with plt.ioff():
    # interactive mode will be off
    # figures will not automatically be shown
    fig2 = plt.figure()
    # ...

為了啟用作為上下文管理器的可選用途,此函數返回一個 ExitStack 對象,該對象不打算由用戶存儲或訪問。

相關用法


注:本文由純淨天空篩選整理自skytowner.com大神的英文原創作品 matplotlib.pyplot.ioff。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。