C M wrote:
> On Tue, Feb 23, 2010 at 7:00 PM, Mathew Yeates <mat.yea...@gmail.com> wrote:
>   
>> Hi
>> I am using gtk and displaying a plot in a FigureCanvas. In response to an
>> event, I want to update the plot with new data.
>>
>> e.g.
>> self.fig = Figure(figsize=(5,5), dpi=100)
>> self.ax = fig.add_subplot(111)
>> ax.plot(data[0,0:,0],
>>
>>
>>
>> canvas = FigureCanvas(fig)
>> canvas.set_size_request(500,500)
>>
>> def on_some_signal(self,widget):
>>     ?????
>>
>>
>> I've tried a number of different things. How do you do this?
>>     
>
> I may be wrong here, but isn't it:
>
> def on_some_signal(self,widget):
>     ax.plot(yournewdata)
>     canvas.draw()
>
> Che
>
>   
I also may be wrong.

I thought ax.plot(..) would redraw everything (ticks, labels, etc)  to 
do with the plot.

I've been using set_data as I thought it was meant to be quicker.
                self.cline[0].set_data(rX, myabs) # I have to make sure 
I use correct line
                         ::          ::
                self.canvas.draw()

To just change the data associated with a specific line on plot.

I stored the lines on my graph in a list called cline,  I captured the 
line at time of creating of the plot
                r = self.axis.plot( rX, myabs ,self.linestyle, color='b')
                self.cline.append( r[0] )


- Steve




------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to