Ok heres round 2 thank guys for help with the previous problem, but I am back to where I started unfortunately. All this happened when I tried to add a line to this graph. The incoming data is a list coming from another program. For testing purposes I am having the other program spit out [100,110]. I want 100 for one line and 110 for another. Eventually this will be incoming data from an Arduino that will be live data. I keep getting this error.
AttributeError Traceback (most recent call last)
/Users/Tyler/Desktop/Arduino/Graphing_22.py in on_redraw_timer(self, event)
284 #self.data.extend(self.datagen.next())
285
--> 286 self.draw_plot()
287
288 def on_exit(self, event):
/Users/Tyler/Desktop/Arduino/Graphing_22.py in draw_plot(self)
240 visible=self.cb_xlab.IsChecked())
241
--> 242 self.plot_data.set_xdata(np.arange(len(self.data[0])))
243 #self.plot_data.set_xdata(np.arange([1,1000])
244 self.plot_data.set_ydata(np.array(self.data[1]))
AttributeError: 'list' object has no attribute 'set_xdata'
Here is the code for the incoming data and where the error is occurring.
def __init__(self):
wx.Frame.__init__(self, None, -1, self.title)
self.datagen = DataGen()
self.data = self.datagen.next()
#splitting data at '
#self.data = [self.datagen.next().split(",")
self.paused = False
if self.cb_grid.IsChecked():
self.axes.grid(True, color='gray')
else:
self.axes.grid(False)
# Using setp here is convenient, because get_xticklabels
# returns a list over which one needs to explicitly
# iterate, and setp already handles this.
#
pylab.setp(self.axes.get_xticklabels(),
visible=self.cb_xlab.IsChecked())
self.plot_data.set_xdata(np.arange(len(self.data[0])))
#self.plot_data.set_xdata(np.arange([1,1000])
self.plot_data.set_ydata(np.array(self.data[1]))
self.canvas.draw()
Thanks for the help guys!