- Notifications
You must be signed in to change notification settings - Fork 134
Expand file tree
/
Copy pathPython_05_Plot_Area.py
More file actions
Latest commit
40 lines (30 loc) · 745 Bytes
/
Copy pathPython_05_Plot_Area.py
File metadata and controls
40 lines (30 loc) · 745 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 27 08:09:11 2020
@author: Tin
"""
# Plot Area Chart
importmatplotlib.pyplotasplt
importpandasaspd
pd.set_option('max_columns', None) # To show all columns
importyfinanceasyf
yf.pdr_override()
# input
symbol='AAPL'
start='2019-01-01'
end='2020-01-01'
# dataframe
data=yf.download(symbol,start,end)
print('Plot Histogram Chart')
plt.figure(figsize=(12,8))
data['Adj Close'].plot.area()
plt.title("Stock Area Chart")
plt.xlabel("Date")
plt.ylabel("Price")
plt.show()
data[['Open','High','Low','Adj Close']].plot.area(stacked=False)
plt.title("Stock Area Chart")
plt.xlabel("Date")
plt.ylabel("Price")
plt.legend(loc='best')
plt.show()