matplotlib : plt.subplot 여러 그래프 동시에 보여주기 2
fig,ax 튜플보다 그래프 설정하는 문법이 좀 더 익숙해서 좋다. plt.figure(figsize=(20,20)) plt.subplot(2,2,1) plt.bar(index, dff_1['출고수량']) plt.title('요일별', fontsize=30) plt.xticks(index, label, fontsize=15) plt.subplot(2,2,2) plt.bar(index, dff_2['출고수량']) plt.title('요일별', fontsize=30) plt.xticks(index, label, fontsize=15) plt.subplot(2,2,3) plt.bar(index, dff_3['출고수량']) plt.title('요일별', fontsize=30) plt.xticks(index, l..
2022. 7. 14.
matplotlib : 산점도 scatter
scatter 프로토타입 sizes = df['학년'] plt.figure(figsize=(10,10)) plt.scatter(df['영어'], df['수학'], s= sizes * 500, c = df['학년'], cmap='Set3', alpha=0.9) plt.xlabel('영어 점수') plt.ylabel('수학 점수') plt.colorbar(ticks=[1, 2, 3], label='학년', shrink=0.8, orientation ='horizontal')
2022. 7. 14.
Numpy : np.where / if 함수역할
df['sex'] = np.where(df['sex'] == 3, np.nan, df['sex']) df 예시1 mpg['grade2'] = np.where(mpg['total'] >= 30, 'A', np.where(mpg['total'] >= 25, 'B',np.where(mpg['total'] >= 20, 'C', 'D'))) mpg['size'] = np.where((mpg['category'] == 'compact') | (mpg['category'] == 'subcompact') | (mpg['category'] == '2seater'), 'small', 'large') mpg['size'] = np.where(mpg['category'].isin(['compact','subcompact','..
2022. 7. 14.
matplotlib : 원그래프(파이그래프)
values = [30, 25, 20, 13, 10, 2] labels = ['Python', 'Java', 'Javascript', 'C#', 'C/C++', 'ETC'] plt.pie(values, labels= labels, autopct='%.2f%%', counterclock=False) plt.show() values = [30, 25, 20, 13, 10, 2] labels = ['Python', 'Java', 'Javascript', 'C#', 'C/C++', 'ETC'] explode = [0.05] * 6 plt.pie(values, labels= labels, autopct='%.2f%%', explode=explode, counterclock=False) plt.legend() pl..
2022. 7. 13.