Hello everyone,
I Have a problem. I have a graph inserted in a PyQt interface and I
want to clear it (When I click on a button).
I initialise the graph like that:
class Graph(FigureCanvas):
def __init__(self,parent):
self.fig = Figure()
self.ax = self.fig.add_subplot(111)
FigureCanvas.__init__(self, self.fig)
self.R1, time,= [], []
self.l_R1, = self.ax.plot([], self.R1,"-o", color = 'b',
label='R1')
self.fig.canvas.draw()
FigureCanvas.updateGeometry(self)
Later on the program I append values to the arrays: self.R1 and time and I do:
self.l_R1.set_data(time, self.R1)
self.fig.canvas.draw()
FigureCanvas.updateGeometry(self)
So the values are correctly added to the Graph. My problem is I want
to clear the graph and re-initialize the arrays self.R1 and time to
empty arrays.
I've tried to create a def activated by a button that do:
self.R1, time,= [], []
self.l_R1, = self.ax.plot([], self.R1,"-o", color = 'b',
label='R1')
self.fig.canvas.draw()
FigureCanvas.updateGeometry(self)
But no effects...
Anybody has an idea?
Thanks!
Fab