my matplotlib realtime plot doesn't show the line between the points

Nicolas Marat nicolas.maratclimb at gmail.com
Tue Mar 31 06:43:28 EDT 2020


hi guys, i need help because my matplotlib realtime plot doesn't show the line between the points.
even if i right '.k-' 
thit plot is display in a qwidget in an other code
wirdely that if i put bar it actualy working.
the real time data come from an arduino sensor 
that the shape of the data i have to plot:

    ser_bytes = ser.readline()
    value = float(ser_bytes[0:len(ser_bytes)-2].decode("utf-8"))




that is my code: 

class MplWidget(QWidget ):
    
    
    def __init__( self, parent = None):

        QWidget.__init__(self, parent)
        
        self.canvas = FigureCanvas(Figure())
        
        vertical_layout = QVBoxLayout() 
        vertical_layout.addWidget(self.canvas)
        
        self.canvas.axes = self.canvas.figure.add_subplot(1,1,1)
        self.canvas.axes.set_ylim(0,90)
        self.canvas.axes.set_xlim(0,100)
        self.setLayout(vertical_layout)
       
        
    def update_graph(self, value):
        
        y = list()
        x = list()


        y.append(value)
        x.append(self.i)
                             
        self.i += 1
        
       
        self.MplWidget.canvas.axes.set_xlim(left=max(0, self.i-40), right= self.i+60)
        self.MplWidget.canvas.axes.bar(x, y,)#'.k-')
        self.MplWidget.canvas.axes.set_title('pull') 
        self.MplWidget.canvas.draw()



thanks for help!
        


More information about the Python-list mailing list