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
Post a Comment