Code:
class CustumGraph(pg.GraphicsWindow):
    pg.setConfigOption('background', 'w')
    pg.setConfigOption('foreground', 'k')
    
    def __init__(self, parent=None, **kargs):
        pg.GraphicsWindow.__init__(self, **kargs)
        self.setParent(parent)
        #colors to plot with
        self.colors = [(0, 0, 0),(255, 0, 0),(0, 0, 255),(0, 255, 0),(255, 
0, 255),(0, 255, 255),(255, 255, 0),(255, 128, 0),(128, 0, 255)]
        self.p = None
        
    def graph(self, x, y, headers):
        #x is a list of the time
        #y is a list of list with data-points
        #headers is a list of headers
        if self.p == None: #create plot if it doesn't exist yet
            self.p = self.addPlot(labels =  {'left':'Pressure (mBar)', 
'bottom':'Time (s)'})
        try:# remove legend if it exist otherwise it just gets longer
            self.legend.scene().removeItem(self.legend)
        except:
            print("First plotting sequence..")
        #clear the plot of previous data
        self.p.clear()
        #make legend and graph
        self.legend = self.p.addLegend(offset=(-10,10)) 
        self.p.showGrid(x=True,y=True)
        
        #checks if y is a list of lists, otherwise makes a list of it
        if type(y[0]) != list:
            y=[y]
        #empty list with the length of y to store the curves
        curves = [0]*len(y)
        #plot the y-data in different collors with the headers
        for i in range(0,len(y)):
            curves[i] = self.p.plot(pen=None,symbol='o',name=headers[i], 
symbolSize=1, symbolPen=self.colors[i])
            curves[i].setData(x, y[i])

When I create the CustomGraph and run the function graph it maxes out on 9 
graphs in the plot, while the length of the y-list is longer.
Anyone know why?

-- 
You received this message because you are subscribed to the Google Groups 
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyqtgraph/a7d4be36-d4f0-4f01-b9f8-0e33918092cf%40googlegroups.com.

Reply via email to