pyqtgraph

How can I use DateAxisItem of PyQtGraph?

拈花ヽ惹草 提交于 2020-04-06 07:42:30
问题 I'm using PyQtGraph '0.9.8+gd627e39' on Python 3.6.2(32bit) and Windows 10. My goal is to plot real time data with an X-axis that shows datetime. Time Value datetime.datetime(2018, 3, 1, 9, 36, 50, 136415) 10 datetime.datetime(2018, 3, 1, 9, 36, 51, 330912) 9 datetime.datetime(2018, 3, 1, 9, 36, 51, 382815) 12 datetime.datetime(2018, 3, 1, 9, 36, 52, 928818) 11 ... I looked up related issues such as https://gist.github.com/friendzis/4e98ebe2cf29c0c2c232, pyqtgraph, plotting time series, but

pyqtgraph绘制曲线图(2)

孤者浪人 提交于 2020-03-17 07:48:56
pyqtgraph 绘制静态图,并将其加入到窗体中(GUI) 导入相关库和数据 import pyqtgraph as pg import pandas as pd import sys import numpy as np from PyQt5 import QtCore , QtWidgets x = np . random . random ( 10 ) pg . plot ( x , title = "坚持" ) #该行代码只是绘制了图形,但是没有执行的GUI窗口,所以直会一闪而过 x = [ 2 , 4 , 6 , 8 , 10 , 12 , 14 , 16 , 18 , 20 , 22 , 24 , 26 , 28 , 30 , 32 , 34 , 36 , 38 , 40 , 42 , 44 , 46 , 48 , 50 ] y = [ 10 , 12 , 15 , 16 , 20 , 25 , 26 , 28 , 30 , 25 , 36 , 38 , 39 , 55 , 42 , 41 , 20 , 12 , 10 , 23 , 2 , 35 , 36 , 37 , 56 , ] #绘制窗体,并将图形添加到窗体中 # 主窗口类 class MainWidget ( QtWidgets . QMainWindow ) : def __init__ ( self )

Python - Fast ploting using pyqtgraph (16ms)?

梦想与她 提交于 2020-01-30 06:44:28
问题 I need to plot an continuous input using pyqtgraph, so I use a circular buffer to hold the data. I use deque with maxlen to do the job. (Python 2.7, numpy 1.9.2, pyqtgraph 0.9.10) from collections import deque def create_cbuffer(self): buffer_len = self.BUFFER_LEN*self.number_of_points data = [0]*buffer_len # buffer_len = 160k self.cbuffer[0] = deque(data, maxlen=buffer_len) buffer_len = self.BUFFER_LEN data = [0]*buffer_len self.cbuffer[1] = deque(data, maxlen=buffer_len) After that I use it

Using time in Scatter plot items x-axis in pyqt4

微笑、不失礼 提交于 2020-01-25 07:37:06
问题 import sys from pyqtgraph.Qt import QtGui, QtCore import pyqtgraph as pg import numpy as np app = QtGui.QApplication(sys.argv) mw = QtGui.QMainWindow() mw.resize(800, 800) view = pg.GraphicsLayoutWidget() mw.setCentralWidget(view) mw.setWindowTitle('pyqtgraph example: ScatterPlot') w1 = view.addPlot() x = ['0:09:48', '0:09:49', '0:09:50', '0:09:51', '0:09:52', '0:09:53', '0:09:54', '0:09:55', '0:09:56', '0:09:57'] x1=[583, 584, 585, 586, 587, 588, 589, 590, 591, 592] y = [10, 8, 6, 4, 2, 20,

Draw half infinite lines?

不羁岁月 提交于 2020-01-24 12:42:30
问题 I use pyqtgraph for data acquisition and I have to represent some thresholds on the graphics view. For example to represent a high voltage limit, etc. I used the class InfiniteLine from pyqtgraph, but now, I have to take into account some possible changes on the threshold value during the acquisition. It would look as a step between two infinite line (please find an example attached). example For this, I would have to draw a half infinite line. Do you know a simple way to do it? I thought

PyQtGraph grid with linked axes

 ̄綄美尐妖づ 提交于 2020-01-22 16:38:07
问题 Having a simple graphics layout with PyQtGraph in which the x-axis of the plots are linked together and the grid is displayed in both plots as well: from pyqtgraph.Qt import QtGui, QtCore import pyqtgraph as pg app = QtGui.QApplication([]) view = pg.GraphicsView() l = pg.GraphicsLayout() view.setCentralItem(l) view.show() view.resize(800,600) p0 = l.addPlot(0, 0) p0.showGrid(x = True, y = True, alpha = 0.3) #p0.hideAxis('bottom') p1 = l.addPlot(1, 0) p1.showGrid(x = True, y = True, alpha = 0

pyqtgraph: how to drag a a plot item

柔情痞子 提交于 2020-01-14 03:52:07
问题 Currently trying to plot a scatter plot in pyqtgraph and trying to drag the plot items but unable to find the approach. Already looked at GraphicsScene sigMouseClicked, sigMouseMoved events. Any suggestions welcome. Let me know in case any further details are required from my side. Sample code which I am using: import pyqtgraph as pg import numpy as np w = pg.GraphicsWindow() w.show() x = [2,4,5,6,8]; y = [2,4,6,8,10]; pl = pg.PlotItem() pl.plot(x, y, symbol='o') w.addItem(pl) 回答1: Have a

Live Plotting with PyQtGraph in PyQt4

末鹿安然 提交于 2020-01-13 17:59:50
问题 I am quite new in Python and TRYING to make a PyQt4 app, where I am embedding PyQtGraph in it. I've got this PyQtGraph live plotter that works fantastically: from pyqtgraph.Qt import QtGui, QtCore import pyqtgraph as pg import random app = QtGui.QApplication([]) p = pg.plot() curve = p.plot() data = [0] def updater(): data.append(random.random()) curve.setData(data) #xdata is not necessary timer = QtCore.QTimer() timer.timeout.connect(updater) timer.start(0) if __name__ == '__main__': import

Is there an easy way to zoom two plot widgets at once?

人走茶凉 提交于 2020-01-07 07:23:11
问题 I am currently working on a graphical display tool for EEG data. My group wants to be able to zoom the plot to see certain channels. However, there is a separate widget beside the waveform plot which displays the labels for the channels. I want to make it so that when the waveform plot is zoomed (say using ViewBox's RectMode zoom), the channel labels will also zoom. I have included a picture of our display for reference. 来源: https://stackoverflow.com/questions/40020266/is-there-an-easy-way-to

How do I clear a ScatterPlotItem in PYQTGRAPH

柔情痞子 提交于 2020-01-07 02:52:04
问题 I am attempting to move a "cursor" around my graph using ScatterPlotItem and a '+' symbol as the cursor. The cursor updates its position perfectly but I cannot figure out how to clear the last instance. Here is the line that I use to plot the 'cursor'. self.cursor2 = self.p2_3.addItem(pg.ScatterPlotItem([self.xx], [self.yy], pen=None, symbol='+', color = 'b')) I tried self.cursor2.clear() but that didn't work. Any help is appreciated. 回答1: When you call addItem you add the plotdataitem, in