Chans

legend-2

Jul 4th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. import matplotlib.pyplot as plt
  2. import pandas as pd
  3.  
  4. file = '../stocks.csv'
  5.  
  6. stock = pd.read_csv(file, parse_dates=['Date'], index_col=['Date'])
  7.  
  8. plt.plot(stock.index, stock['AAPL'], color='red', label='Apple')
  9. plt.plot(stock.index, stock['MSFT'], color='blue', label='Microsoft')
  10. plt.xlabel('Date')
  11. plt.ylabel('Stock price')
  12. plt.title('Stock price in 2000')
  13.  
  14. plt.legend(loc='best')
  15.  
  16. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment