Advertisement
lalkaed

ComplexChart

Sep 6th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.15 KB | None | 0 0
  1. import codecademylib
  2. from matplotlib import pyplot as plt
  3.  
  4. months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
  5.  
  6. visits_per_month = [9695, 7909, 10831, 12942, 12495, 16794, 14161, 12762, 12777, 12439, 10309, 8724]
  7.  
  8. # numbers of limes of different species sold each month
  9. kl = [92.0, 109.0, 124.0, 70.0, 101.0, 79.0, 106.0, 101.0, 103.0, 90.0, 102.0, 106.0]
  10. pl = [67.0, 51.0, 57.0, 54.0, 83.0, 90.0, 52.0, 63.0, 51.0, 44.0, 64.0, 78.0]
  11. bl = [75.0, 75.0, 76.0, 71.0, 74.0, 77.0, 69.0, 80.0, 63.0, 69.0, 73.0, 82.0]
  12.  
  13.  
  14. # create your figure here
  15. plt.figure(figsize=(12,9))
  16. ax1 = plt.subplot(1,2,1)
  17. x_vals = range(len(months))
  18. plt.plot(x_vals,visits_per_month,marker='o')
  19. plt.xlabel('Month')
  20. plt.ylabel('Visits')
  21. ax1.set_xticks(x_vals)
  22. ax1.set_xticklabels(months)
  23. plt.title('Overall Sales')
  24. ax2 = plt.subplot(1,2,2)
  25. x_vals = range(len(months))
  26. plt.plot(x_vals,kl,color='green')
  27. plt.plot(x_vals,pl,color='orange')
  28. plt.plot(x_vals,bl,color='pink')
  29. plt.legend(['Key','Persian','Blood'])
  30. ax2.set_xticks(x_vals)
  31. ax2.set_xticklabels(months)
  32. plt.title('Sales by Type')
  33. plt.show()
  34. plt.savefig('limeSalesCharts.pdf')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement