Advertisement
pestiand82

Grafikon teszt

Sep 21st, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.79 KB | None | 0 0
  1. from matplotlib import pyplot as plt
  2. from random import randint
  3.  
  4. print(plt.style.available)
  5. plt.style.use('fivethirtyeight')
  6.  
  7. x_values = [1,2,3,4,5]
  8.  
  9. download_speed = [randint(60, 800) for i in range(5)]
  10. upload_speed = [randint(20, 200) for i in range(5)]
  11. average_speed = [randint(100, 600) for i in range(5)]
  12.  
  13. plt.plot(x_values, download_speed, color="#485FD4", linewidth=2, linestyle='--', marker='o', label="Download Speed")
  14. plt.plot(x_values, upload_speed, color="#D4BD48", linewidth=2,  marker='o', label="Upload Speed")
  15. plt.plot(x_values, average_speed, color="#48D48E", linewidth=2,  marker='o', label="Average Speed")
  16.  
  17. plt.xlabel("Time")
  18. plt.ylabel("Speed")
  19.  
  20. plt.legend()
  21. # plt.legend(loc='lower center')
  22. # plt.legend(loc=(0.2, 0.4))
  23. plt.savefig('test_plot.png')
  24. # plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement