visualize_1_3.py 778 B

123456789101112131415161718192021222324
  1. def plot_util(self):
  2. self.fig, self.graph = plt.subplots(figsize=self.window_shape)
  3. self.fig.canvas.mpl_connect('close_event', self.on_close)
  4. self.graph.yaxis.set_visible(False)
  5. self.graph.xaxis.set_visible(False)
  6. self.graph.text(0, 1.15, self.title, transform=self.graph.transAxes,
  7. size=24, weight=300, ha='left', va='top')
  8. self.bar_collections = self.graph.bar(self.x, self.arr[0], align='edge', width=0.5)
  9. # since the animate method in not returning any thing, thus we are using blit=False
  10. anim = FuncAnimation(self.fig, self.animate, frames=self.arr.shape[0],
  11. interval=self.interval, blit=0, repeat=self.repeat,
  12. repeat_delay=1000)
  13. plt.box(False)
  14. time.sleep(1)
  15. plt.show()
  16. anim.event_source.stop()
  17. del anim
  18. plt.close()