I am receiving new data every one second from a sensor in rasperry pi and appending the same in existing list. I want to dynamically update Bar chart every second as per the list. I am able to do that but it is taking more than a second. Please suggest how to resolve this issue. In my program I am keeping blit= False. Please help how can I turn on the blit with bar chart, so that plot recovery may get faster.
class PlotAnimate(): #threading.Thread
def __init__(self):
x_vals=[0,0,0,0,0,0,0,0,0]
y_vals=[0,0,0,0,0,0,0,0,0]
data= [x_vals, y_vals]
ls_param=[0,19]
index= count()
self.fig= plt.figure(num =1,facecolor = "black")
self.ax= self.fig.add_subplot(111)
self.ax.set_facecolor("black")
plt.axis('off')
plt.tick_params(axis = "both", left = False, right = False, bottom = False, top =False)
self.bar1 = FigureCanvasTkAgg(self.fig,root.t1.frame_chart)
self.ani= FuncAnimation(self.fig, self.animate, blit= False,interval= 250)
plt.tight_layout()
self.bar1.get_tk_widget().pack(side=LEFT, fill=BOTH, expand = 1)
def animate(self,i):
#chart update
index = []
for j in range(root.t1.hist_size):#
index.append(j)
plt.tight_layout()
self.ax.cla()
plt.axis('off')
plt.tick_params(axis = "both", left = False, right = False, bottom = False, top =False)
self.ax.bar(index,root.t1.dose_list,color = root.t1.colors)#self.bar_dose,