[Python/파이썬] Pandas Matplotlib - GDP plot
# 추출 및 변환 코드
df00=pd.read_excel('C:/fintech6/_project1/_src/gdp.xlsx', index_col=0)
*gdp.xlsx
(출처 : KOSIS )
2. plot 생성
# plot 생성
product_plot=df00.plot(grid=True,style=['-o'],markersize=4)
# 스타일 지정
str_plt_style = 'seaborn-darkgrid'
plt.style.use([str_plt_style])
plt.rcParams["figure.figsize"] = (15,4)
plt.rcParams["font.size"]=15
# x축, y축에 모든 항목 표기
plt.xticks([2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,
2011,2012,2013,2014,2015,2016,2017,2018,2019,2020])
plt.yticks([-1,0,1,2,3,4,5,6,7,8,9])
# 마이너스 부호가 표기되도록 하는 설정
matplotlib.rcParams['axes.unicode_minus'] = False
# 저장
image_file='C:/fintech6/_project1/_img/gdp.png'
plt.savefig(image_file,dpi=400)
댓글
댓글 쓰기