[PyQt] Fwd: Multiple plotting using loops in python
binsha s
binshasrn at gmail.com
Wed May 22 08:59:06 BST 2019
---------- Forwarded message ---------
From: binsha s <binshasrn at gmail.com>
Date: Tue, May 21, 2019 at 10:20 AM
Subject: Multiple plotting using loops in python
To: <pyqt-request at riverbankcomputing.com>
I have x data as:
x_data:[[-210.99],[210.666],[553.211],[123.332],.....[234.121]]
If I have n columns then y1,y2,...yn should be plotted with x_data so that
within one graph n data can be visualized. I am also using slideshow for
visualizing a clear view of each column data. For appearing data as a
slideshow I am splitting each data of y1, y2,...yn into 5 data with x_data.
For example if I have columns as Col-1 and Col-2 then:
y1=[[10.556],[12.5687],[44.5568],...[66.6679]]
y2=[[10.4075],[12.5456],[23.5456],...[76.567]]
The split data of y1, y2 with x_data should be plotted multiple and appear
as slideshow. For that I combined into one array as
splitArraylist=[array[[10.556],[12.5687],[44.5568],...[66.6679]]),array([[10.4075],[12.5456],[23.5456],...[76.567]])]
What I have tried is:
checked_list=[1,2]
gvalue=5
self.XY(splitArraylist)
def XY(self,y):
y1=np.array(y)
for i in range(len(checked_list)):
self.splitXy(y1[i][0])
self.graphXY()
def splitXy(self,res):
current_iter=0
#Splitting each data of y1 into 5 graphs
for j in range(gvalue):
x_data.append(x[current_iter:current_iter+iters])
y_data.append(res[current_iter:current_iter+iters])
current_iter=current_iter+iters
def graphXY(self):
global cp, loopbool
for j in range(len(checked_list)*gvalue):
if loopbool == True:
n_graphs.append(str(j + 1))
cp = int(n_graphs[len(n_graphs)- 1])
#PLotting each set of data in y1 and y2 with x_data
self.plotDraw(x_data[j],y_data[j])
loop = QEventLoop()
QTimer.singleShot(int(sec_value), loop.quit)
loop.exec_()
j = j + 1
def plotDraw(self, x0, y0):
self.MplWidget.canvas.axes.clear()
self.MplWidget.canvas.axes.plot(x0, y0)
self.MplWidget.canvas.axes.legend(('cosinus', 'sinus'),
loc='upper right')
self.MplWidget.canvas.axes.set_title('Signal')
self.MplWidget.canvas.draw()
Currently data is plotting one after the other data. That is first set of
data y1 and is split and plotted. Then next column y2 is plotted and appear
as a slideshow.
I actually want y1 and y2 data to occur in single graph and appear as a
slideshow. (i.e.) For the first graph of slideshow first split data of y1
and y2 occur in one graph then second split data of y1 and y2 ... likewise
5 graphs should be there.
How to do I do this? How can multiple plotting be achieved using loops and
arrays?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20190522/0d1d8ed3/attachment.html>
More information about the PyQt
mailing list