matplotlib.pyplot在调用show后继续



出于调试目的,我希望在使用matplotlib时,让脚本显示中间步骤,而不仅仅是最终绘图。问题是,调用plt.show()后,轴将重置,并重新开始绘制。有没有办法调用plt.show()并继续使用同一个轴?

我在PyCharm内部工作。

代码概念:

import statements
create part of plot
plt.show()
create next part of plot
plt.show() # Should show whatever was in the first plotted window plus what was added in the meantime
create final part of plot
plt.show() # Should show whatever was in the second plotted window plus what was added in the meantime

谢谢!

编辑:系统:运行Python 3.7.1和matplotlib 3.3.3 的Windows 10

您的最佳选择是在绘图发展过程中保存绘图,然后比较不同保存的数字。

#create part of plot
plt.savefig('first_part')
#create rest of plot
plt.savefig('second_part')

最新更新