我如何告诉 matplotlib 我已经完成了一个情节? [英] How do I tell matplotlib that I am done with a plot?

查看:24
本文介绍了我如何告诉 matplotlib 我已经完成了一个情节?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下代码绘制了两个 PostScript (.ps) 文件,但第二个包含两行.

The following code plots to two PostScript (.ps) files, but the second one contains both lines.

import matplotlib
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab

plt.subplot(111)
x = [1,10]
y = [30, 1000]
plt.loglog(x, y, basex=10, basey=10, ls="-")
plt.savefig("first.ps")


plt.subplot(111)
x = [10,100]
y = [10, 10000]
plt.loglog(x, y, basex=10, basey=10, ls="-")
plt.savefig("second.ps")

如何告诉 matplotlib 重新开始第二个情节?

How can I tell matplotlib to start afresh for the second plot?

推荐答案

你可以使用 figure 创建一个新的绘图,例如,或者在第一个之后使用 close情节.

You can use figure to create a new plot, for example, or use close after the first plot.

这篇关于我如何告诉 matplotlib 我已经完成了一个情节?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆