Advertisement
RapidR3D

Financial_Bar_Graph

Mar 4th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.01 KB | None | 0 0
  1. import matplotlib.pyplot as plt
  2.  
  3. balance = {'08.12.16': 637.22,
  4.            '09.16.16': 1633.43,
  5.            '09.19.16': 983.43,
  6.            '09.23.16': 1274.38,
  7.            '09.29.16': 1114.38,
  8.            '09.30.16': 1699.75}
  9.  
  10. #I manually entered my information into a dictionary because I only had a few months worth of information but I'm sure I
  11. # could have just as easily used f = open('somefile.txt', 'r') or something of the kind...
  12.  
  13. key = list(dict.keys(balance))
  14. val = list(balance.values())
  15.  
  16. plt.bar(range(len(balance)), balance.values(), align='center', color = 'blue')
  17. plt.xticks(range(0, 68), key, rotation=45)
  18. plt.title('FINANCES', color= 'red')
  19. plt.margins(0.01)
  20. plt.subplots_adjust(bottom=0.3)
  21. plt.text(2, 1500, 'RAPIDR3D_FINANCE', style='italic',
  22.         bbox={'facecolor':'red', 'alpha':0.5, 'pad':10})
  23. plt.xlabel('Dates', color ='red')
  24. plt.tick_params(axis='x', colors='red')
  25. plt.ylabel('Dollars', color ='green')
  26. plt.tick_params(axis='y', colors='green')
  27. plt.tight_layout()
  28.  
  29. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement