converting is just for the ui files matplotlib or numpy, u can design u r main interface in qt designer after converting to .py u can add matplotlib functionality to that
@@ParwizForogh let me know that i have a list which has data and i want to plot a graph in graphic View which i have already Design in QT designer .waiting for your reply
hey this video really help me out, but can you make a video to update plots with radio buttons, as using canvas is just showing figures of what matplotlib is making
@@ParwizForogh Please don't just create the basic visualization which everyone is doing. It will be great if you make the full tutorial on the same and if possible with the streaming data as well.
Here is what I have achieved so far . # Import libraries from numpy import * from pyqtgraph.Qt import QtGui, QtCore import pyqtgraph as pg from random import randrange, uniform import serial # from scipy.fftpack import fft # Create object serial port portName = "COM12" baudrate = 9600 # ser = serial.Serial(portName,baudrate) ### START QtApp ##### app = QtGui.QApplication([]) # you MUST do this once (initialize things) #################### win = pg.GraphicsWindow(title="Signal from serial port") win.resize(1000,900)# creates a window p = win.addPlot(title="X WINDOW",row = 0, col = 0) # creates empty space for the plot in the window curve = p.plot(pen='r') # create an empty "plot" (a curve to plot) windowWidth = 900 # width of the window displaying the curve # windowHeight = 700 Xm = linspace(0,0,windowWidth) # create array that will contain the relevant time series # print("XM VALUES ARE ",Xm) # print("Length is ",len(Xm)) ptr = -windowWidth # set first x position p2= win.addPlot(title = 'Y WINDOW',row=1, col = 0) curve2= p2.plot(pen='g') # p3= win.addPlot(title = 'Z WINDOW',row=2, col = 0) curve3= p3.plot(pen='y') #Plot for FFT X # p4 = win.addPlot(title = "FFT X",row = 3,col = 0) # curve4 = p4.plot(pen='') #Plot for FFT Y # p5 = win.addPlot(title = "FFT Y",row = 4,col = 0) # curve5 = p5.plot(pen='o') #Plot for FFT Z # p6 = win.addPlot(title = "FFT Z",row = 5,col = 0) # curve6 = p6.plot(pen='y') # Realtime data plot. Each time this function is called, the data display is updated def update(): global curve, ptr, Xm,curve2,curve3,curve4,curve5,curve6 Xm[:-1] = Xm[1:] # shift data in the temporal mean 1 sample left # value = ser.readline() # read line (single value) from the serial port value = uniform(0,100) # print("Values are :",value) # print("Length of the values are : ",len(str(value))) Xm[-1] = float(value) # vector containing the instantaneous values # print("Xm is :",Xm[-1]) ptr += 1 # update x position for displaying the curve curve.setData(Xm) # set the curve with this data curve.setPos(ptr,0) # set x position in the graph to 0 curve2.setData(Xm) curve3.setData(Xm) # curve4.setData() # curve5.setData() # curve6.setData() QtGui.QApplication.processEvents() # you MUST process the plot now ### MAIN PROGRAM ##### # this is a brutal infinite loop calling your realtime data plot while True: update() ### END QtApp #### pg.QtGui.QApplication.exec_() # you MUST put this at the end ################
You can support me on Patreon
www.patreon.com/parwizforogh
If I'm correct, converting a QT Designer UI file to a .py file does this automatically. Possibly not for matplotlib and numbpy.
converting is just for the ui files matplotlib or numpy, u can design u r main interface in qt designer after converting to .py u can add matplotlib functionality to that
@@ParwizForogh let me know that i have a list which has data and i want to plot a graph in graphic View which i have already Design in QT designer .waiting for your reply
Why would you create a new class for it?
Anything like this displaying a stock chart? Thanks
yea u can print every kind graphs
@@ParwizForogh Did one and printed fine. Thanks a lot.
Is there any code download? I've searched on his website and could't find it.
this is the source code : codeloop.org/how-to-embed-matplotlib-graph-in-pyqt5/
how to right align the graph ?
u need to use layouts
Is this possible for 64 bit?
yea it is possible
Perfect timing! I need this lesson! Thanks.
What IDE are you using? Nice video.
Pycharm
hey this video really help me out, but can you make a video to update plots with radio buttons, as using canvas is just showing figures of what matplotlib is making
Fantastic bro
Great Video! thank you for the explanation and for sharing the code. you are a life saver! :)
Great! Your video helped me to work out my course design! Thanks.
Thanks. Wonderful video. I love it.
Excelente explicación, lo felicito. ¿Cómo podría hacer un gráfico en tiempo real usando PyQy5? Saludos desde Venezuela.
man !! you are writin your code like you are writing it to your self ,,,please explain what you do
great! Thank you help me !
It worked but i didn't understand anything. thankyou very much
Add comments in your coding..
ok i will do
How to plot the live streaming data in pyqt5? Please make one tutorial for the same.
i will make
@@ParwizForogh Please don't just create the basic visualization which everyone is doing. It will be great if you make the full tutorial on the same and if possible with the streaming data as well.
Here is what I have achieved so far .
# Import libraries
from numpy import *
from pyqtgraph.Qt import QtGui, QtCore
import pyqtgraph as pg
from random import randrange, uniform
import serial
# from scipy.fftpack import fft
# Create object serial port
portName = "COM12"
baudrate = 9600
# ser = serial.Serial(portName,baudrate)
### START QtApp #####
app = QtGui.QApplication([]) # you MUST do this once (initialize things)
####################
win = pg.GraphicsWindow(title="Signal from serial port")
win.resize(1000,900)# creates a window
p = win.addPlot(title="X WINDOW",row = 0, col = 0) # creates empty space for the plot in the window
curve = p.plot(pen='r') # create an empty "plot" (a curve to plot)
windowWidth = 900 # width of the window displaying the curve
# windowHeight = 700
Xm = linspace(0,0,windowWidth) # create array that will contain the relevant time series
# print("XM VALUES ARE ",Xm)
# print("Length is ",len(Xm))
ptr = -windowWidth # set first x position
p2= win.addPlot(title = 'Y WINDOW',row=1, col = 0)
curve2= p2.plot(pen='g')
#
p3= win.addPlot(title = 'Z WINDOW',row=2, col = 0)
curve3= p3.plot(pen='y')
#Plot for FFT X
# p4 = win.addPlot(title = "FFT X",row = 3,col = 0)
# curve4 = p4.plot(pen='')
#Plot for FFT Y
# p5 = win.addPlot(title = "FFT Y",row = 4,col = 0)
# curve5 = p5.plot(pen='o')
#Plot for FFT Z
# p6 = win.addPlot(title = "FFT Z",row = 5,col = 0)
# curve6 = p6.plot(pen='y')
# Realtime data plot. Each time this function is called, the data display is updated
def update():
global curve, ptr, Xm,curve2,curve3,curve4,curve5,curve6
Xm[:-1] = Xm[1:] # shift data in the temporal mean 1 sample left
# value = ser.readline() # read line (single value) from the serial port
value = uniform(0,100)
# print("Values are :",value)
# print("Length of the values are : ",len(str(value)))
Xm[-1] = float(value) # vector containing the instantaneous values
# print("Xm is :",Xm[-1])
ptr += 1 # update x position for displaying the curve
curve.setData(Xm) # set the curve with this data
curve.setPos(ptr,0) # set x position in the graph to 0
curve2.setData(Xm)
curve3.setData(Xm)
# curve4.setData()
# curve5.setData()
# curve6.setData()
QtGui.QApplication.processEvents() # you MUST process the plot now
### MAIN PROGRAM #####
# this is a brutal infinite loop calling your realtime data plot
while True: update()
### END QtApp ####
pg.QtGui.QApplication.exec_() # you MUST put this at the end
################
@@XploreMotivation hello, does your code work? I'm trying to display an ECG using matplotlib and PyQt5 but I'm struggling ( on a raspberry pi)
0 explaination on what is what and why. I guess he doesn't really understand what he is doing.
Sir, you did not explain a thing. You just repeated what you wrote with zero explanation.
Good content, terrible presentation