python中PyQwt的使用
来源:互联网 发布:英语单词书写软件 编辑:程序博客网 时间:2024/06/01 08:58
python中除了matplotlib外,PyQwt也可以用于画图。前者是基于wxpython,后者是基于PyQt,有异曲同工之妙。
下面是一个小例子:
# -*- coding: utf-8 -*-import sysimport numpy as npfrom PyQt4.QtCore import *from PyQt4.QtGui import *from PyQt4.Qwt5 import *class Ex01(QWidget): ''' 创建QwtPlot对象, 通过调用QwtPlot对象的方法setTitle(String)来设定图的标题文字 setAxisTitle(AxisId, String)用来设定坐标轴的标题 fig.xBottom和fig.yLeft为QwtPlot对象的属性,分别代表fig的下方x轴和左边的y轴 ''' def __init__(self): QWidget.__init__(self) fig = QwtPlot() fig.setParent(self) text = "f(x) = x + x<sup>2<\sup>" fig.setTitle(text) fig.setAxisTitle(fig.xBottom, "x") fig.setAxisTitle(fig.yLeft, "f(x)") x = np.arange(0, 10, 0.1) y = x +x**2 curve = QwtPlotCurve() curve.setData(x, y) curve.attach(fig) fig.replot() fig.resize(400, 300)def main(): app = QApplication(sys.argv) frame = Ex01() frame.show() app.exec_()if __name__ == "__main__": main()
- python中PyQwt的使用
- python中PyQwt的使用 画图(一)
- python 中configparser的使用
- Python中类的使用
- python中关键字的使用
- Python中线程的使用
- python中线程的使用
- python中字符串的使用
- python中数组的使用
- python中线程的使用
- python中全局变量的使用
- python中match的使用
- python 中with的使用
- Python中ghost的使用
- python中eval的使用
- python中进程的使用
- python中线程的使用
- python中re的使用
- BIOS、BootLoader、uboot对比
- Sublime Text 2 使用心得
- uva 10474 Where is the Marble?
- Linux下的C和C++面试题(10/19自己整理小结)
- JS操作Cookie写入和读取的简便方法(一看就懂,直接能用!)!
- python中PyQwt的使用
- INSTALL_FAILED_VERSION_DOWNGRADE报错
- hadoop系统命令
- C++ Date Structure 4
- Nutch入门教程一
- Encoding URLs
- 快速排序—java
- ADB server didn't ACK终极解决方法
- 总述