采用addplot()方法将多个图形添加到一个窗口。

首先利用numpy模块创建两个随机数组,用来作为图形绘制的数据:

import pyqtgraph as pg
import numpy as np x = np.random.random(50)
y = np.random.random(10)
z = np.r_[x,y]
def pg_addplot():
app = pg.QtGui.QApplication([])
win = pg.GraphicsWindow(title="PyQtGraph Tutorial")
p1 = win.addPlot(title='x曲线')
p1.plot(x)
p2 = win.addPlot(title='y曲线')
p2.plot(y)
app.exec_()

上图为1行2列布置,通过nextRow()更改为2行1列

def pg_addplot():
app = pg.QtGui.QApplication([])
win = pg.GraphicsWindow(title="PyQtGraph Tutorial")
p1 = win.addPlot(title='x曲线')
p1.plot(x)
win.nextRow()
p2 = win.addPlot(title='y曲线')
p2.plot(y)
app.exec_()

将多个图形放置在一个窗口内,并且占用不同列数

def pg_addplot():
app = pg.QtGui.QApplication([])
win = pg.GraphicsWindow(title="PyQtGraph Tutorial")
p1 = win.addPlot(title='x曲线')
p1.plot(x)
p2 = win.addPlot(title='y曲线')
p2.plot(y)
win.nextRow()
p3 = win.addPlot(colspan=2,title='z 曲线')
p3.plot(z)
app.exec_()


最新文章

  1. 适配布局-ios
  2. ural One-two, One-two 2
  3. 谈谈patch strategy
  4. 【codevs1743】 反转卡片
  5. Ext.MessageBox消息框
  6. How Tomcat Works(六)
  7. 去掉 CONSOLE 窗口(转)
  8. poj 2503 Babelfish (查找 map)
  9. 排序算法TWO:快速排序QuickSort
  10. Linux 常见文件打包压缩命令
  11. jquery hide() show()
  12. 如何判断网页中引入jquery
  13. JS面向对象基础
  14. CF766 E. Mahmoud and a xor trip [预处理][树形dp]
  15. whereis 命令详解
  16. [NOI 2011]道路修建
  17. 《HelloGitHub》第 32 期
  18. bug管理工具之禅道的测试模块的使用
  19. nginx r日志中午出现\xE5\x88\x98\xE4\xB8\x96\xE5\xA5\x87
  20. CMake 常用方法

热门文章

  1. vs2015 cppunit配置及使用
  2. Notification API,为你的网页添加桌面通知推送
  3. 9.1 Go 反射
  4. Django之ORM外部python脚本使用
  5. Django数据库表初始化缓存清除
  6. BZOJ1017 树形DP
  7. 验证for循环打印数字1-9999所需要使用的时间(毫秒)
  8. JUC整理笔记二之聊聊volatile
  9. pandas手册
  10. JS代码静态分析及挖掘