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

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to