* pyqtgraph 내려받기

 

* 예제 소스 (극곡선 r = 2 cos(3 theta) 그리기)

# -*- coding: utf-8 -*-

# Filename: testPyQtGraph_03.py
# Execute: python testPyQtGraph_03.py


from pyqtgraph.Qt import QtGui, QtCore
import numpy as np
import pyqtgraph as pg

app = QtGui.QApplication([])

win = pg.GraphicsWindow(title="Basic plotting examples")

win.resize(400, 500)
win.setWindowTitle('pyqtgraph example: Plotting')

# Enable antialiasing for prettier plots
pg.setConfigOptions(antialias=True)

p1 = win.addPlot(title="Parametric, grid enabled")
a = 2.0
k = 3.0
theta = np.linspace(0, 2*np.pi, 1000)
x = a*np.cos(theta)*np.cos(k*theta)
y = a*np.sin(theta)*np.cos(k*theta)
p1.plot(x, y)
p1.showGrid(x=True, y=True)

if __name__ == '__main__':
    import sys
    if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
        QtGui.QApplication.instance().exec_()

 

* 실행 결과:

 

 

더 많은 pyqtgraph 예제:

프롬프트> cd %PYTHON27_HOME%\\Lib\site-packages\pyqtgraph

프롬프트> python -m examples

 

 

 

Posted by Scripter
,