Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class CreateGraph():
- def construct(self):
- xar=[]
- yar=[]
- graph=plt.plot(xar,yar)[0]
- plt.ion()
- plt.axis([0,1,0,50])
- plt.ylabel("Sentiment")
- plt.xlabel("Number of Tweets")
- plt.show()
- plt.pause(0.001)
- return graph
- class UpdateGraph():
- def __init__(self,graph):
- #self.fig=plt.figure()
- #self.ax1=self.fig.add_subplot(1,1,1)
- self.xar=[]
- self.yar=[]
- #self.h1=self.ax1.plot(self.xar, self.yar)[0]
- def update_plot(self):
- graph_data=open("twitter-out.txt", "r")
- graph_data=list(graph_data)
- graph_data=graph_data[0].split(",")
- x=0
- y=0
- for l in graph_data:
- x+=1
- y=float(l)
- self.xar.append(x)
- self.yar.append(y)
- graph.set_xdata(self.xar)
- graph.set_ydata(self.yar)
- print(graph)
- graph.draw()
- graph.pause(0.001)
- Failed: draw_wrapper() missing 1 required positional argument: 'renderer'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement