Multiple checkboxes to select which plots to show

50 views
Skip to first unread message

Rita Roxo

unread,
Mar 8, 2017, 9:30:42 AM3/8/17
to pyqtgraph
Hello,

I am trying to make an app to plot the signals received from a microcontroller. The main point is to be able to plot the signal from the different channels. I created different checkboxes in order to be able to choose from which channel I want to plot the data. 

I have this code for one checkbox and it works:

def plot_channels(self,ch): 
        self.view = pg.GraphicsView()
        self.view.show()
        
        if ch.text() == "Channel 0":
            if ch.isChecked() == True:
                self.dataPlot_0 = np.sin(np.linspace(0, 5 *np.pi , 2000))
        
                self.graph_0 = pg.PlotItem()
                self.graph_0.plot(self.dataPlot_0)

                self.lay = pg.GraphicsLayout()                    
                self.lay.addItem(self.graph_0)

                self.view.setCentralItem(self.lay)
                #self.view.showMaximized()


However, when I create a second checkbox related to another channel and also check it another window appears with the second signal and replace the first one.

I want to have only one window when the different plots appear as soon I check the respective checkbox.

Can someone help me to figure it out?

Thank you for the time and help.

Regards,

RR

Reply all
Reply to author
Forward
0 new messages