티스토리 뷰

IT/Pandas : 데이터

[Pandas] plot 그래프

useful-jang 2019. 9. 16. 16:57

df.plot()

데이터 프레임 값을 그래프로 출력

total_year[-15:].plot(x='year', y=['action', 'comedy'], figsize=(10,5), grid=True)

출처 : https://datascience.stackexchange.com/questions/25596/how-to-plot-two-columns-of-single-dataframe-on-y-axis

 

 

df.plot()rc('font', family='AppleGothic')

한글 폰트 출력

import matplotlib.pyplot as plt
from matplotlib import rc

rc('font', family='AppleGothic')
plt.rcParams['axes.unicode_minus'] = False

 

출처 : https://pinkwink.kr/990

 

 

sns.heatmap()

히트맵으로 출력

f, ax = plt.subplots(figsize=(11, 15)) 
heatmap = sns.heatmap(corr_matrix, 
                      mask = mask,
                      square = True,
                      linewidths = .5,
                      cmap = ’coolwarm’,
                      cbar_kws = {'shrink': .4, 
                                ‘ticks’ : [-1, -.5, 0, 0.5, 1]},
                      vmin = -1, 
                      vmax = 1,
                      annot = True,
                      annot_kws = {“size”: 12})
#add the column names as labels
ax.set_yticklabels(corr_matrix.columns, rotation = 0)
ax.set_xticklabels(corr_matrix.columns)
sns.set_style({'xtick.bottom': True}, {'ytick.left': True})

출처 : https://towardsdatascience.com/annotated-heatmaps-in-5-simple-steps-cc2a0660a27d

 

 

 

df.matshow()

데이터 프레임 값을 그래프로 출력

plt.matshow(df.corr())
plt.xticks(range(len(df.columns)), df.columns)
plt.yticks(range(len(df.columns)), df.columns)
plt.colorbar()
plt.show()

출처 : http://benalexkeen.com/correlation-in-python/

 

 

 

 

'IT > Pandas : 데이터' 카테고리의 다른 글

[Pandas] DataFrame  (0) 2019.09.16
[Pandas] 전처리  (0) 2019.09.16
[Pandas] merge 병합  (0) 2019.09.16
[Pandas] 데이터 형태  (0) 2019.09.16
[Pandas] read_csv 기능 설명  (0) 2019.09.16
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/05   »
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
글 보관함