pyqtgraph

Realtime plotting in Python

烈酒焚心 提交于 2019-12-11 07:17:59
问题 I have a data stream giving me 125 floats per second and I want to plot them live. At the moment my code looks like this: Code to read data from stream counter = 0 while True: counter = counter+1 data from stream (x values) In reality the code looks a bit more complicated, of course, but this will make giving advice easier, I think. I was thinking about just saving the graph as a file: counter=0 a_data=np.zeros(100,float) #this is limited to 100 floats while True: counter = counter+1

QThreading PyQtGraph PlotWidgets in PyQt4

北城余情 提交于 2019-12-11 01:53:28
问题 As a continuation of the question I got solved here some days ago, I've got a PyQt4 GUI which embeds two PyQtGraph's PlotWidgets, which each set/update data from an threaded randomly-appending array triggered by a button. It works beautifully, and the GUI is responsive. But there comes a point, where the graphs stop showing the updates inside their respective PlotWidgets, and I have to minimize/maximize to see the updates drawn inside the PlotWidgets. The code looks like: import random import

Plotting with pyqtgraph using external data

我们两清 提交于 2019-12-10 22:15:28
问题 I'm trying to plot data of diferentes sensors en realtime,so I decided to plot the data using PyQtGraph in PyQt, in order to make it work with several sensor's data from differnte sources. Searching example on the internet, i found one and i tried to adapt it , Because of QtGui.QApplication.instance().exec_(), which carries the inconvenient side effect of blocking the execution of the rest of the code after it. I tried to manage to used threads using Multiproccessing. I could make the rest of

Issue in setting the background color in pyqtgraph

只愿长相守 提交于 2019-12-10 20:39:42
问题 I've got an issue when using the pyqtgraph module in python. When I put a white background color to a glscatterplot, the scatter dots just vanish. It is like if the color of background was added to the color of the scatterplot therefore everything is white. Here is a piece of the code I use: w = gl.GLViewWidget() w.setBackgroundColor('w') w.show() sp3 = gl.GLScatterPlotItem(pos=np.transpose(pos3), color=rgba_img, size=1, pxMode=False) w.addItem(sp3) If I replace ('w') by ('k') in the

PyQtGraph - how do I close a plot window/close all plot windows?

五迷三道 提交于 2019-12-10 15:44:32
问题 I tried pg.close() but that didn't work, couldn't find it in the manual. I produce plots in a loop, so I'd like to close them all at the end of each loop (instead it pops a new window open until my computer goes nuts). 回答1: All Qt widgets have a close method. And you can close all windows using QApplication.closeAllWindows. 回答2: The code shown below has a exit method. from pyqtgraph.Qt import QtGui, QtCore import pyqtgraph as pg import numpy as np import time import sys class guiThread(QtCore

QGridLayout with PlotWidget-pyqtgraph

﹥>﹥吖頭↗ 提交于 2019-12-08 07:51:58
问题 I have 3 PlotWidget (from the pyqtgraph library), obj1 , obj2 and obj3 , which I try to insert in a QGridLayout. I want to display all three objects in a single row, but obj1 must be twice as large as obj2 and obj3 . Thus I wrote: layout.addWIdget(obj1, 0, 0, 1, 2) layout.addWidget(obj2, 0, 2, 1, 1) layout.addWidget(obj3, 0, 3, 1, 1) However, visually, obj1 is much smaller than obj2 and obj3 which do have the same size: --------------------------------------------------- | obj1 | obj2 | obj3

pyqtgraph: how to drag a a plot item

…衆ロ難τιáo~ 提交于 2019-12-07 01:58:31
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) Have a look at pyqtgraph/examples/CustomGraphItem.py. The approach there is to create a GraphItem subclass that

Python pyqtgraph how to set x and y axis limits on graph, no autorange

十年热恋 提交于 2019-12-06 22:07:21
问题 I would like to know how I can set the x and y axis limits that are displayed for a pyqtgraph.GraphicsWindow.addPlot object. I need to display a lot of data inside a loop (hence using pyqtgraph) but I would rather preallocate my axes as opposed to allowing autorange to potentially enhance speed. As an example, from pyqtgraph.Qt import QtGui, QtCore import numpy as np import pyqtgraph as pg app = QtGui.QApplication([]) win = pg.GraphicsWindow(title="My plotting examples") win.resize(1000,600)

Embed a pyqtgraph plot into a QT .ui?

删除回忆录丶 提交于 2019-12-06 14:35:14
问题 first of all I hope you have me some patience since I'm new on these kind of projects and I also hope not to be asking dumb questions. That being said, my main objective is to create a UI for a raspberry pi 3 which will sense voltage, current, etc from a battery and from a solar panel. Since I'm working on a raspberry and have some knowledge on Python3, I decided to use QTCreator which as I understand can be translated into python3 through pyqt (https://nikolak.com/pyqt-qt-designer-getting

Python pyqtgraph how to set x and y axis limits on graph, no autorange

寵の児 提交于 2019-12-05 03:47:37
I would like to know how I can set the x and y axis limits that are displayed for a pyqtgraph.GraphicsWindow.addPlot object. I need to display a lot of data inside a loop (hence using pyqtgraph) but I would rather preallocate my axes as opposed to allowing autorange to potentially enhance speed. As an example, from pyqtgraph.Qt import QtGui, QtCore import numpy as np import pyqtgraph as pg app = QtGui.QApplication([]) win = pg.GraphicsWindow(title="My plotting examples") win.resize(1000,600) win.setWindowTitle('pyqtgraph example: Plotting') p1 = win.addPlot(title="plot1") p2 = win.addPlot