plot_log.py 472 B

123456789101112131415161718
  1. import matplotlib.pyplot as plt
  2. with open('delays.log') as file:
  3. log = [float(x) for x in file.readlines()]
  4. TIME = log.pop(0)
  5. DELTA_T = log.pop(0)
  6. fig2 = plt.figure()
  7. ax2 = fig2.subplots()
  8. ax2.set_title("Duration Log (T = {:.2f}, dt = {:.2f})".format(TIME, DELTA_T))
  9. ax2.set_xlabel("Iterations")
  10. ax2.set_ylabel("Time")
  11. # ax2.plot([-1, len(log)], [DELTA_T, DELTA_T], c='red')
  12. # ax2.plot([-1, len(log)], [0.01, 0.01], c='green')
  13. ax2.bar(range(len(log)), log)
  14. plt.show()