- 2x2 형태 그래프 및 각 그래프에 여러 line 중첩해서 그리기
- 각 그래프 내에 범례 제거
- 각 그래프의 축 이름 (label) 제거
from matplotlib import pyplot as plt
import matplotlib.pylab as plt2
import seaborn as sns
# plot 크기 조정
plt2.rcParams["figure.figsize"] = (15,10)
# 2x2 형태 생성
fig, axs = plt.subplots(2,2)
# cd list에 속한 element에 따라 2x2 형태로 plot 그리기
l_cd = ['1','2','3','4']
# Flatten
axx = axs.ravel()
for i, v_cd in enumerate(l_cd):
sns.lineplot(x="date", y="amt", hue="cd", data=df_all[df_all['cd']==v_cd], ax=axx[i])
axx[i].set(ylabel=None) #y축 label(이름) 제거
# plt.legend(loc='upper right') # 범례 위치 조정
axx[i].legend().remove() # 범례 제거
'언어 꿀Tip > Python 꿀tip!' 카테고리의 다른 글
07_01_48. DB2 연결하여 SQL로 데이터 산출 (0) | 2021.06.14 |
---|---|
07_01_47. json 파일 불러오기 (0) | 2021.06.09 |
07_01_45. groupby 컬럼명 level 합치기 (0) | 2021.06.04 |
07_01_44. seaborn multiple line chart 여러개 동시에 그래프그리기 (0) | 2021.06.03 |
07_07_43. chi-square test (카이제곱 검정) (0) | 2021.06.01 |