pyqtgraph

How to update a realtime plot and use buttons to interact in pyqtgraph?

你离开我真会死。 提交于 2019-12-04 20:16:32
I used the "scrolling graph" example from pyqtgraph.examples as template to create a plot, which shows a continuous sinus wave. Now, I would like to use buttons to change the amplitude of the sinus wave. This is why I used another structure (see the code below). This doesn't work, it only plots a static sinus wave. How can I use my update function to plot the continuous sinus wave? How can I chage the amplitude by using the buttons? I have already checked this and this without success. import sys from PyQt4 import QtGui, QtCore import numpy as np import pyqtgraph as pg class sinus_wave(QtGui

Embed a pyqtgraph plot into a QT .ui?

走远了吗. 提交于 2019-12-04 20:09:52
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-started/ ). I installed it on my raspberry pi and made the following UI: after having a basic UI, I

pyqtgraph: Multiple y-axis on left side?

别等时光非礼了梦想. 提交于 2019-12-04 19:37:57
I have found the MultiplePlotAxes-example in pyqtgraph and extended it with one more y-axis (see code below). So there are 3 y-axis on the right side now. Is there a way to get all 3 y-axis from the right side to the left side so that there are in total 4 y-axis on the left side?: Because for example ax3 = pg.AxisItem('left') only changes the orientation of the label and ticks of an axis but not the position of the axis relative to the origin of co-ordinates. modifed MultiplePlotAxes-example import pyqtgraph as pg from pyqtgraph.Qt import QtCore, QtGui import numpy as np pg.mkQApp() pw = pg

Live Data Monitor: PyQtGraph

牧云@^-^@ 提交于 2019-12-03 08:20:55
I am working on a project where I will have to analyse signals coming from a device. I have a library working which gets me data from the device. As of now, I am collecting the data and then plotting it. I am interested in building a live data monitor which can plot a graph in real time. Upon searching, I figured out PyQtGraph is ideal for the task. I am not familiar with Qt, so I am looking for examples which I can modify to my needs. Some examples given in PyQtGraph docs update the plot real-time BUT I need something like a live monitor- where the graph is moving towards the right as it

python pyqtgraph 保存图片到本地

匿名 (未验证) 提交于 2019-12-02 22:56:40
pyqtgraph官方给的示例居然会报错2333 官方文档传送门: #####pyqtgraph export pyqtgraph支持在可视化窗口中右键保存(Exporting from the GUI)试了一下只能保存为svg格式, 保存为png会闪退不知道是我这里的原因还是这里有bug,我希望直接生成图片(Exporting from the API) 先查看本地site-packages里面有test文件,里面有生成svg的版本画出来的图是svg格式只能放在浏览器看不能改后缀名 而我希望生成png之类的图片 折腾了一下终于弄了一个能跑的出来: from __future__ import division, print_function, absolute_import import pyqtgraph as pg import pyqtgraph.exporters import numpy as np def test_plotscene(): pg.setConfigOption( ‘ foreground ‘ , (255,255,255 )) w = pg.GraphicsWindow() p = w.addPlot() p.plot(np.linspace( 0.0, 20.0, 20), pen={ ‘ color ‘ : ‘ w ‘ }) p

pyqtgraph: align the ticks of the x-axes in different plots

感情迁移 提交于 2019-12-02 12:24:48
问题 This is a follow up to this question. The question is how to adapt the x-axis scaling of multiple pyqtgraphs when one of the graphs is rescaled. My desired result is that the ticks of all graphs align perfectly, so that you can directly compare the content of both graphs. The given answer archives that task, of rescaling the graphs on changes but when the content of the graphs differs the y-Axis description tends to be of different size which somehow messes everything up. For example in the

pyqtgraph: When I click on a PlotItem how do I know which item has been clicked

你。 提交于 2019-12-02 11:55:51
I don't konw if my method is the right method, but it works. class PltItem(pg.PlotItem): pltClicked = Signal() def __init__(self, parent = None): super(PltItem, self).__init__(parent) def mousePressEvent(self, ev): super(PltItem, self).mousePressEvent(ev) self.pltClicked.emit() the in the main window i use for i, plt in enumerate(self.plts): self.connect(plt, SIGNAL("pltClicked()"), partial(self.selectplot, i)) def selectplot(self, i): ... Your solution is a good one. Another solution is to connect to the GraphicsScene.sigMouseClicked signal and use QGraphicsScene.items() to determine whether

How can I update a custom graphic item (in pyqtgraph) whenever a COM event occurs?

让人想犯罪 __ 提交于 2019-12-02 11:50:20
问题 I made a program that receives every transaction information of crude oil futures in real time. Basically, OnReceiveRealData executes when a transaction is executed and calls real_get method. In the method, current time, price and volume data are collected and a dictionary is made with them. There are more methods to make OHLC format data from this real time streaming data, but the point of my question is how to update a custom graphic item(a candlestick plot) whenever real_get method is

plotting the spectrum of a wavfile in pyqtgraph using scipy.signal.spectrogram

别等时光非礼了梦想. 提交于 2019-12-02 09:47:50
问题 I have a PyQt plus pyqtgraph program for music and speech analysis and I want to plot the spectrum of a wav file (calculated using scipy python package). I can do it in matplotlib but due to matplotlib's performance I need to switch to pyqtgraph but I cant find any consistent method to plot the output of scipy.signal.spectrogram in to pyqtgraph Thanks! 回答1: The output of the Scipy Spectrogram can be easily plotted as an ImageItem from pyqtgraph. Normally, the resulting Spectrogram is only in

How can I update a custom graphic item (in pyqtgraph) whenever a COM event occurs?

一个人想着一个人 提交于 2019-12-02 07:28:50
I made a program that receives every transaction information of crude oil futures in real time. Basically, OnReceiveRealData executes when a transaction is executed and calls real_get method. In the method, current time, price and volume data are collected and a dictionary is made with them. There are more methods to make OHLC format data from this real time streaming data, but the point of my question is how to update a custom graphic item(a candlestick plot) whenever real_get method is called? class COM_Receiver(QAxWidget): def __init__(self): super().__init__() self._create_com_instance()