Hello!
I did thread, where plot updated every 1 second. In Jupyter all right. But in voila, I haven’t updated plot.
Code below:
def learning_curves(stop_button):
metrics_graphic_buffer.append(f_score[0])
metrics_graphic_buffer1.append(f_score[1])
metrics_graphic_buffer2.append(f_score[2])
stop_button.on_click(stoping)
with output_learning_curves:
clear_output()
# print("Metrics graphic buffer", metrics_graphic_buffer)
plt.figure(figsize=(12, 12))
plt.axis([0, 20, 0, 1.1])
plt.plot(metrics_graphic_buffer, 'r--', label = 'Tap',
linewidth = 1.0)
plt.plot(metrics_graphic_buffer1, 'g--', label = 'Toilet',
linewidth = 3.0)
plt.plot(metrics_graphic_buffer2, 'y--', label = 'Shower',
linewidth = 5.0)
plt.plot(avr, 'black', label = 'Average f-score',
linewidth = 4.0)
plt.legend(loc='upper right', prop={'size': 12})
plt.draw()
time.sleep(1)
if flag == False:
print ('Status flag1', flag)
break
Initial thread :
thread = threading.Thread(target=learning_curves, args=(stop_button, ))
Start thread :
def on_clicked_Learn_button(state):
with output_learning_curves:
thread.start()
Thanx for your help !