Skip to content

Commit d9c64ca

Browse files
Add files via upload
1 parent 8eeb41a commit d9c64ca

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

Python_6_Plot_Area.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# -*- coding: utf-8 -*-
2+
"""
3+
Created on Fri Nov 27 08:09:11 2020
4+
5+
@author: Tin
6+
"""
7+
# Plot Area
8+
import matplotlib.pyplot as plt
9+
import pandas as pd
10+
11+
pd.set_option('max_columns', None) # To show all columns
12+
13+
import yfinance as yf
14+
yf.pdr_override()
15+
16+
17+
# input
18+
symbol = 'AAPL'
19+
start = '2019-01-01'
20+
end = '2020-01-01'
21+
22+
23+
# dataframe
24+
data = yf.download(symbol,start,end)
25+
26+
print('Plot Histogram Chart')
27+
plt.figure(figsize=(12,8))
28+
data['Adj Close'].plot.area()
29+
plt.title("Stock Area Chart")
30+
plt.xlabel("Date")
31+
plt.ylabel("Price")
32+
plt.show()
33+
34+
35+
data[['Open','High','Low','Adj Close']].plot.area(stacked=False)
36+
plt.title("Stock Area Chart")
37+
plt.xlabel("Date")
38+
plt.ylabel("Price")
39+
plt.legend(loc='best')
40+
plt.show()

0 commit comments

Comments
 (0)