带有matplotlib的Python-并行绘制多个图形 [英] Python with matplotlib - drawing multiple figures in parallel

查看:270
本文介绍了带有matplotlib的Python-并行绘制多个图形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我具有一些有助于生成图形的一小部分的功能.我正在尝试使用这些功能来生成多个图形吗?像这样:

I have functions that contribute to small parts of a figure generation. I'm trying to use these functions to generate multiple figures? So something like this:

  1. 使用图1
  2. 做其他事情
  3. 使用图2
  4. 做其他事情
  5. 使用图1
  6. 做其他事情
  7. 使用图2

如果有人可以帮助,那就太好了!

If anyone could help, that'd be great!

推荐答案

有几种方法可以做到这一点,最简单的方法就是使用数字.下面的代码制作了两个数字#0和#1,每个数字都有两行. #0的点是1,2,3,4,5,6,#2的点是10,20,30,40,50,60.

There are several ways to do this, and the simplest is to use the figure numbers. The code below makes two figures, #0 and #1, each with two lines. #0 has the points 1,2,3,4,5,6, and #2 has the points 10,20,30,40,50,60.

from pylab import *

figure(0)
plot([1,2,3])

figure(1)
plot([10, 20, 30])

figure(0)
plot([4, 5, 6])

figure(1)
plot([40, 50, 60])

show()

这篇关于带有matplotlib的Python-并行绘制多个图形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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