真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

Python3.x+pyqtgraph實(shí)皇冠現(xiàn)體育網(wǎng)站開(kāi)發(fā)數(shù)據(jù)可視化

1、pyqtgraph庫(kù)數(shù)據(jù)皇冠體育網(wǎng)站開(kāi)發(fā) haozbbs.com Q1446595067可視化效果還不錯(cuò),特別是窗體程序中圖像交互性較好;安裝也很方便,用 pip 安裝。

創(chuàng)新互聯(lián)公司是一家專(zhuān)注于網(wǎng)站建設(shè)、成都做網(wǎng)站與策劃設(shè)計(jì),漢陽(yáng)網(wǎng)站建設(shè)哪家好?創(chuàng)新互聯(lián)公司做網(wǎng)站,專(zhuān)注于網(wǎng)站建設(shè)10多年,網(wǎng)設(shè)計(jì)領(lǐng)域的專(zhuān)業(yè)建站公司;建站業(yè)務(wù)涵蓋:漢陽(yáng)等地區(qū)。漢陽(yáng)做網(wǎng)站價(jià)格咨詢:18982081108

2、在Python中新建一個(gè) .py 文件,然后寫(xiě)入如下代碼并執(zhí)行可以得到官方提供的很多案例(含代碼),出現(xiàn)如下界面圖像:

import pyqtgraph.examples
pyqtgraph.examples.run()

圖1

圖2

圖3

4、程序默認(rèn)是黑色背景,這個(gè)是可以修改的。比如,在程序的開(kāi)頭部分寫(xiě)入如下代碼就可以修改背景:

pg.setConfigOption('background', 'w')
pg.setConfigOption('foreground', 'k')

更多說(shuō)明,見(jiàn) pyqtgraph 官網(wǎng):http://www.pyqtgraph.org/documentation/style.html,“Line, Fill, and Color”部分的“Default Background and Foreground Colors”部分。

5、一個(gè)修改背景顏色的完整案例如下,可以直接運(yùn)行程序:

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

# 如下2行代碼是我自己加入的,目的是修改默認(rèn)的黑色背景為其它顏色背景
pg.setConfigOption('background', 'w')
pg.setConfigOption('foreground', 'k')

from pyqtgraph.Point import Point

#generate layout
app = QtGui.QApplication([])
win = pg.GraphicsWindow()
win.setWindowTitle('pyqtgraph example: crosshair')
label = pg.LabelItem(justify='right')
win.addItem(label)
p1 = win.addPlot(row=1, col=0)
p2 = win.addPlot(row=2, col=0)

region = pg.LinearRegionItem()
region.setZValue(10)
# Add the LinearRegionItem to the ViewBox, but tell the ViewBox to exclude this
# item when doing auto-range calculations.
p2.addItem(region, ignoreBounds=True)

#pg.dbg()
p1.setAutoVisible(y=True)

#create numpy arrays
#make the numbers large to show that the xrange shows data from 10000 to all the way 0
data1 = 10000 + 15000 * pg.gaussianFilter(np.random.random(size=10000), 10) + 3000 * np.random.random(size=10000)
data2 = 15000 + 15000 * pg.gaussianFilter(np.random.random(size=10000), 10) + 3000 * np.random.random(size=10000)

p1.plot(data1, pen="r")
p1.plot(data2, pen="g")

p2.plot(data1, pen="w")

def update():
    region.setZValue(10)
    minX, maxX = region.getRegion()
    p1.setXRange(minX, maxX, padding=0)

region.sigRegionChanged.connect(update)

def updateRegion(window, viewRange):
    rgn = viewRange[0]
    region.setRegion(rgn)

p1.sigRangeChanged.connect(updateRegion)

region.setRegion([1000, 2000])

#cross hair
vLine = pg.InfiniteLine(angle=90, movable=False)
hLine = pg.InfiniteLine(angle=0, movable=False)
p1.addItem(vLine, ignoreBounds=True)
p1.addItem(hLine, ignoreBounds=True)

vb = p1.vb

def mouseMoved(evt):
    pos = evt[0]  ## using signal proxy turns original arguments into a tuple
    if p1.sceneBoundingRect().contains(pos):
        mousePoint = vb.mapSceneToView(pos)
        index = int(mousePoint.x())
        if index > 0 and index < len(data1):
            label.setText("x=%0.1f,   y1=%0.1f,   y2=%0.1f" % (mousePoint.x(), data1[index], data2[index]))
        vLine.setPos(mousePoint.x())
        hLine.setPos(mousePoint.y())

proxy = pg.SignalProxy(p1.scene().sigMouseMoved, rateLimit=60, slot=mouseMoved)
#p1.scene().sigMouseMoved.connect(mouseMoved)

## Start Qt event loop unless running in interactive mode or using pyside.
if __name__ == '__main__':
    import sys
    if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
        QtGui.QApplication.instance().exec_()

當(dāng)前名稱:Python3.x+pyqtgraph實(shí)皇冠現(xiàn)體育網(wǎng)站開(kāi)發(fā)數(shù)據(jù)可視化
本文來(lái)源:http://weahome.cn/article/ijjihh.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部