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

查看:93
本文介绍了如何告诉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天全站免登陆