【问题标题】:Closing a matplotlib figure in Pycharm在 Pycharm 中关闭 matplotlib 图
【发布时间】:2019-04-02 21:52:36
【问题描述】:

我想使用 PyCharm 使用 matplotlib 绘制一个图形,显示该图形几秒钟,然后关闭绘图窗口。

经过简单的搜索,我得到了以下代码。这在 Python 在 IDLE/终端中运行时有效。

import matplotlib.pyplot as plt
import numpy as np

plt.imshow(np.zeros((256,256)))
plt.show(block=False)
plt.pause(10)
plt.close('all')

但是 plt.close('all') 似乎没有关闭 PyCharm 生成的任何绘图窗口。

如何以编程方式关闭 PyCharm 生成的绘图窗口?已提出问题 (Close a figure - PyCharm ),但接受的解决方案不起作用。

【问题讨论】:

    标签: python matplotlib pycharm


    【解决方案1】:

    我猜你使用的是 SciView。所以你需要更改pycharm中的设置。

    Settings | Tools | Python Scientific | Show Plots in Toolwindow - box has to be unticked to back to the usual matplotlib figure window 
    

    之后,再试一次。

    【讨论】:

      猜你喜欢
      • 2013-02-14
      • 2017-03-17
      • 2014-09-29
      • 2023-02-22
      • 2023-03-30
      • 1970-01-01
      • 2018-08-23
      • 2017-06-07
      • 1970-01-01
      相关资源
      最近更新 更多