Matplotlib在多处理过程中未显示
令人惊讶的是,我没有发现重现我的问题的问题。下面的代码片段没有显示任何数字,为什么是这种情况,以及如何使数字出现?
import multiprocessing as mp
import time
from matplotlib import pyplot as plt
def f():
f, ax = plt.subplots(1, 1)
ax.plot([1, 2, 3, 3, 4, 5])
plt.show()
if __name__ == '__main__':
process = mp.Process(target=f)
process.start()
time.sleep(5)
process.join()
Surprisingly, I did not find a question reproducing my issue. The code snippet below does not show any figure, why is this the case and how can I get the figure to appear?
import multiprocessing as mp
import time
from matplotlib import pyplot as plt
def f():
f, ax = plt.subplots(1, 1)
ax.plot([1, 2, 3, 3, 4, 5])
plt.show()
if __name__ == '__main__':
process = mp.Process(target=f)
process.start()
time.sleep(5)
process.join()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论