在多处理生成的进程中保存matplotlib图形时遇到问题。根据大量的例子,我发现下面的测试代码应该生成一个名为:测试图png但是,当这段代码在ipython中运行时,png文件实际上从未创建过。在
from multiprocessing import Process
def makeplot():
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot([1,2,3],[3,4,5],'o')
fig.savefig('testfig.png')
plt.close()
return None
p = Process(target = makeplot)
p.daemon = True
p.start()
p.join()
目前没有回答
相关问题 更多 >
编程相关推荐