I want to plot 5 graphs on a single canvas. If i click the next button ,it should display the next graph ,and all graphs should be dynamic using PyQt5
class Window(QWidget):
def __init__(self):
super().__init__()
# Other initialization code...
# Keep track of the current graph index
self.current_graph_index = 0
# Connect next_button to nextGraph method
next_button.clicked.connect(self.nextGraph)
def nextGraph(self):
# Define a list of graph data or functions to plot
graphs = [
self.plotGraph,
self.plotSecondGraph, # Define another method to plot the second graph
self.plotThirdGraph # Define another method to plot the third graph
]
# Increment the current graph index
self.current_graph_index = (self.current_graph_index + 1) % len(graphs)
# Clear the canvas
self.graphWidget1.clear()
# Call the corresponding method to plot the next graph
graphs[self.current_graph_index]()
# Define methods to plot additional graphs if needed
def plotSecondGraph(self):
# Plot the second graph
pass
def plotThirdGraph(self):
# Plot the third graph
pass