python - Refresh the data in bar chart in matplotlib -


the idea want refresh data in bar chart, not update previous data. there method used wipe out previous data of chart , apply new one?

i have following code:

if len(results_tfifg) >= 1:      plt.bar(*zip(*zip(count(), results_tfifg.values())))     plt.title("tf idf chart")     plt.xticks(*zip(*zip(count(0.4), results_tfifg.keys())))     plt.xlabel("word")     plt.ylabel("tf*idf")     self.tf_idf_canvas.draw()  else:     fig = plt.figure()       #append chart form (vbox)     self.tf_idf_canvas = figurecanvas(fig)  # gtk.drawingarea     self.tf_idf_chart_vbox.pack_start(self.tf_idf_canvas)     self.tf_idf_toolbar = navigationtoolbar(self.tf_idf_canvas, self.tf_idf_chart_vbox)     self.tf_idf_chart_vbox.pack_start(self.tf_idf_toolbar,false,false)  

the plt.cla() function should provide you're looking for, clears contents of current axes.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -